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 Challenge Solution

I did everything right but nothing happened

My question is pretty self explanatory but I did everything and entered the exact code from the video and nothing happened except for the page saying boom. I fI could please get some help that would be awesome.

We can't help you without seeing your code.

Here is the code.

// 1. Display an alert dialog with the content: "Warning! This message will self-destruct in" alert("Warning! This message will self destruct in");

// 2. Display a "3... 2... 1..." countdown using 3 alert dialog boxes alert("3..."); alert("2..."); alert("1...");

// 3. This statement selects the <h1> element and replaces its text with "BOOM!". document.querySelector("h1").textContent = "🔥BOOM!🔥";

// 4. Log "Message destroyed!" to the console console.log("Message destroyed!");

Simon Safferson
Simon Safferson
4,150 Points

Hey! I think you might have posted the instructions by accident? :)

Whoops you're right. Here is the code.

alert("Warning! this message will self destruct in..."); alert("3..."); alert("2..."); alert("1..."); document.querySelector("h1").textContent = "🔥BOOM!🔥"; console.log("Message Destroyed");

3 Answers

ethan wolfe
ethan wolfe
5,717 Points

this might sound dumb, but did you save after writing the code? even if its open right in front of you it wont run the code without saving.

I did not actually. How do you save? Thanks for your response.

life saver

ethan wolfe
ethan wolfe
5,717 Points

On windows you can use the "ctrl" + "s" keys. Or in the workspace in the top left there should be a tab called "file" and it should have the save option in it.

Hi,

I have the same issue, I even saved the code however it doesnt display the console.log() message in the console.

Lukas Weckner
Lukas Weckner
2,966 Points

Maybe you wrote put the console.log(); in the same line as the instruction comment "// 4. Log "Message destroyed!" to the console". If that's the case your console.log(); would become a part of the comment and therefore not display as a console message.