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 (Retired) Storing and Tracking Information with Variables Combining Strings

melissa brown
melissa brown
4,670 Points

change to alert box message doesnt pop up?

when i change the message to an alert box instead of document.write the message does not pop up. why is this?

var visitor = prompt("what is your name?");
var message = 'hello ' + visitor;
alert(message);

Melissa, are you using Google Chrome perchance?

2 Answers

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

When I copied and pasted your code in the console, it worked just fine. Is this all your code, or is there perhaps something else before or after that's interfering?

I've had trouble out of Google Chrome with displaying alert, prompt, and other JS activated boxes. Those boxes have been showing up behind the window and have to be blindly interacted with.

Acie Slade
seal-mask
.a{fill-rule:evenodd;}techdegree
Acie Slade
Front End Web Development Techdegree Student 10,895 Points

In case this is causing other folks problems in Chrome, you may need to ensure that you don't have other browser tabs open (as a result of you clicking the "preview workspace" icon from previous JS Basics exercises).

Once I closed all of them, I clicked on "preview workspace" (as if going through the exercise for first time) and the alert box showed up as expected.