Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics Hello, JavaScript! Add JavaScript to HTML

I've checked, rechecked and checked again. I am not getting results. I'm unable to attach the js file for some reason.

I'm unsure of what I'm doing wrong. I have followed the video step by step, and also checked the file up and down myself for mistakes and I can't find anything wrong but the js file is not being run when I open the preview.

Steven Parker
Steven Parker
229,732 Points

Make a snapshot of your workspace and post the link to it here so we can check it out.

https://w.trhou.se/vabr0agwau

I tried with single quotes and double quotes, and also tried on google chrome alongside mozilla. Thank you for your help.

1 Answer

Steven Parker
Steven Parker
229,732 Points

It's good to be consistent, but the kind of quote isn't important.

That is unless the string contains the quoting character , which is the problem in the script.js file:

alert('Hey, you're back for more?');    // the ' inside the string causes a syntax error
alert("Hey, you're back for more?");   // but using different quotes fixes the issue
alert('Hey, you\'re back for more?');  // or you could "escape" the inner character

Ah! Okay, thank you!