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

Self-destructing message solution not working

I have typed in the exact code as provided by the instructor and I am not getting any of the appropriate responses

Same thing happening to me

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Can you please provide the code that you yourself have written? It's still possible you accidentally added or removed something that is causing issues.

1 Answer

Hi,

I have the same code and when I click the preview it open the webpage with the h1 tag but the alerts and other functions are not working for me. Please see the below code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JavaScript Basics – Challenge</title> <link href="css/style.css" rel="stylesheet">
</head> <body> <main> <h1>Welcome to the Webpage!!</h1> </main> <script src="js/script.js"></script>
</body> </html>

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

Please let me know what is wrong with this. Thanks

Message in the console.log is not displaying. I have saved the file as well.