JavaScript JavaScript Basics Introducing JavaScript The Console Challenge Answer

Michael Murphy
Michael Murphy
276 Points

No alerts. No content. Nothing.

Typed the following into scripts.js (I see no obvious way to share the code other than copying and pasting. Really struggling with Treehouse interface. It's a mess in my opinion.):

https://w.trhou.se/t40r2xkt6h

scripts.js file is linked to html via:   <script src="scripts.js"></script> just before the close body tag.

All I get in Chrome is "Can you get the JavaScript to work?" in the browser window.

6 Answers

Colin Marshall
Colin Marshall
32,857 Points

It actually works just fine for me. Try closing out the preview window/tab in your browser, clear your browser cache, and try again.

Jacob Mishkin
Jacob Mishkin
23,081 Points

Agreed, I just forked the workspace and it works. Using IE.

Jacob Proffer
Jacob Proffer
24,584 Points

Works on my end too. Is it possible that he has JavaScript disabled?

Michael Murphy
Michael Murphy
276 Points

Sorry for the delay. Lost connection to site and workspace for a while. Cleared cache, re-opened work space and everything works. There's 90 minutes I'll never get back. Thanks all!

Jacob Proffer
Jacob Proffer
24,584 Points

Hey Michael,

Can you share your workspace or post your HTML?

Colin Marshall
Colin Marshall
32,857 Points

Sounds like he might not know how to share his workspace.

Michael Murphy to share your workspace, you have to create a snapshot of it. To do this, open up the workspace, click the snapshot button in the upper right corner (it looks like a camera) and provide us with the link to the snapshot.

Michael Murphy
Michael Murphy
276 Points

Edited original post - pasted url to snapshot (please tell me if there's a better way to do that) into original post

Colin Marshall
Colin Marshall
32,857 Points

You say your main.js file is linked in your html, but the code you don't see is in your scripts.js file. Is the scripts.js file also linked in your html? If not, link it too.

Michael Murphy
Michael Murphy
276 Points

Typo. Meant to say: "scripts.js" file is linked to "index.html" file. Copying and pasting code does not work, and I do not yet know how to utilize the snapshot link I created.

Colin Marshall
Colin Marshall
32,857 Points

You have to provide us with the link to your snapshot so we can look at it.

Jacob Proffer
Jacob Proffer
24,584 Points

Going out on a whim here but how are you linking your JavaScript files? Are you using the link tag or script tag to do so?

It should look something like this:

<script src="example.js"></script>

Also, if the file is nested inside of a folder, make sure to provide the correct file path.

<script src="js/example.js"></script>
Michael Murphy
Michael Murphy
276 Points

How do I respond to all of your comments? There doesn't seem to be a respond option under any of the comments. This one by Collin has an "add comment" btn. Is it just me? Am I having a lsow day? Or is this whole interface unintuitive?

Michael Murphy
Michael Murphy
276 Points

Jacob: my code in html file is: <script src="scripts.js"></script> Wow! My script code pastes into comment window but does not appear when posted. Workspace snapshot: https://w.trhou.se/t40r2xkt6h

Michael Murphy
Michael Murphy
276 Points

Link to snaphot (had to click on it, have it open in a browser, and then copy the url and paste it here. There has to be a more efficient way to share snapshot link). https://w.trhou.se/t40r2xkt6h

Just press f5 and relaunch preview