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 Capturing Visitor Input and Writing It to the Page

I am not able to get the prompt exercise in which I have to ask "what day is it?". can you help.

Please help I am getting Bummer again and again, my code is: var answer= prompt('what day is it?'); it is showing the dialouge box but showing the bummer.

scripts.js
var answer = 'what day is it?';
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="scripts.js"></script>
</body>
</html>

2 Answers

Guy Noda-Bailey
Guy Noda-Bailey
18,837 Points
var answer;
answer = prompt('What day is it?');

Try the code with two separate commands..... the first one to create the answer variable and the second to put data in it with the prompt.

(Also, be sure to capitalize the W in 'What day is it?')

I need to ask something, why is it wrong to write like:

var answer= prompt('what day is it?');

Guy Noda-Bailey
Guy Noda-Bailey
18,837 Points

I can't see anything wrong with it. Except that the W isn't capitalized.

In terms of JavaScript syntax though, there is nothing wrong with declaring a variable and using a prompt in the same command.

Guy Noda-Bailey
Guy Noda-Bailey
18,837 Points

Update! I just tried the code challenge with the code you tried, it works fine if you capitalize the W.

It was showing the Bummer when I wrote it like that, may be because I was not capitalising W. Thanks for the help.