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! JavaScript Practice Challenge

The page already has BOMB on it when I click preview and I can't figure out it out.

I am using chrome. When I start the new workspace, and click preview as instructed. The page already has BOOM on it and the first window that says ""Warning! This message will self-destruct in", does not pop up and the BOOM is already displayed. Thanks for your help!

If anything you can comment out the pre typed text - save it and boom there will be no message on screen then before you run your code uncomment out the pre typed text and boom hehehhe you done it

8 Answers

Mark Sebeck
MOD
Mark Sebeck
Treehouse Moderator 38,004 Points

It should. The only thing that stops the page from displaying BOMB is the alert box that you will add. (because it waits for you to click on it before executing the rest of the javascript). Go ahead and work through the exercise and if you get stuck let me know or watch the next video. Guil walks you through the solution in the next video.

Thank you!

Mine did the same thing because I hadn't clicked save in the workspace editor

Thanks for the tip, Paige! Forgot about good ole "Save" or "Command + S" before running the page with our code implemented.

Clint Oka
Clint Oka
5,768 Points

awww snap and I thought this was too easy lol. Yes I forgot to save too.

i fixed by <body onload="script();"> to prevent the script load before the body

pr i put the script tag after body before end of html tag

That's expected. If you look inside of the index.html file you'll see that the <h1> contains the string "Hello, JavaScript" and the only line of code in the .js file before we edit it with our own is:

document.querySelector("h1").textContent = "🔥BOOM!🔥";

That line of JavaScript above tells your browser to change

Hello, JavaScript

to

🔥BOOM!🔥

UPDATE: I got it... had it the whole time. =( I thought I had saved after reading the comments here but I surely hadn't. Thank you all for posting these suggestions!

i am having the same issue. i feel as though my script.js file is setup properly but the html is not. i can't figure it out.

Mark Sebeck
Mark Sebeck
Treehouse Moderator 38,004 Points

Glad you were able to solve it Rachel. Great job, keep at it!! and forgetting to save happens often and is the cause of many frustrations.

Prescott Lawani
Prescott Lawani
2,634 Points

You need to put the alerts based on what you see in the comments ("//"). Boom, as he said, is already there but you need to put the code for the alerts first. Check the script.js file to see.

Should I be running Treehouse within Chrome? I am using Opera and I can't get the workspace to work. It just displays the original content if I click preview. ...how do I get the workspace to run what i've done?

Yes, we'd recommend Chrome 👍🏻

The best is with Chrome!