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

Can't display two dialog boxes

Hi, I'm a starter with Javascript. I was trying to run the example of the course on Chrome, but it doesn't work. Here's my code :

console.log("Program started");
var message = "Hello!";
alert(message);
message = "Welcome to Javascript Basics";
alert(message);
console.log("Program ended");

First of all, nothing actually displays in the console which is really bad for troubleshooting. Secondly, my browser only displays one dialog box (the first one), while in the example, it does automaticlly displays another dialog box as it interprets the other lines of code...

I don't understand what's happening...

Working fine for me on console on Chrome: http://recordit.co/IIwFzMJo5r.gif. Are you getting any errors in console while adding this code?

1 Answer

Jeremey,

Your code worked fine for me as well. You have to click on the dialog box to see your second message.