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 trialAlana Warson
5,296 PointsI am confused as to what I am suppose to do with this assignment.
Am I to write my own program using my workspce? I am not sure what tab to use in my workspace. There needs to be a more precise set of instructions such as where your workplace is; which tab to use; what are these "//" on the page that says what to do etc.
Alana Warson
5,296 PointsMy problem is with the JavaScript video about creating program where it says "BOOM" at the end, creating using alert to countdown from 3 to 1. I hope this describes better what I am talking about.
Thanks
2 Answers
Peter Vann
36,427 PointsHi Alana!
I hope this answers your question. I monkeyed with the code and I discovered a flaw in the instructions, which I assume is at the heart of your confusion.
If you put all of this 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!");
In the scripts.js file, you will get error at step #3, because the script runs BEFORE the DOM loads and therefore the h1 doesn't exist yet.
If you put steps #3 and #4 in the app.js file (which runs AFTER the DOM loads), the code will execute just fine.
I hope that helps.
Please let me know if you still have remaining questions.
Stay safe and happy coding!
Peter Vann
36,427 PointsI also commented out:
//alert("Another message from inside index.html");
In the app.js file, so it would run more smoothly.
Again, I hope that helps.
Stay safe and happy coding!
Peter Vann
36,427 PointsPeter Vann
36,427 PointsHi Alana!
Can you please provide a reference course/video/challenge, so I can look further into this for you?
Thanks.
-Pete