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
207,988 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
207,988 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!