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

Hi.What am i doing wrong ? I wrote var answer = prompt("What day is it ?");

Javascript Basics.

scripts.js
var answer = prompt("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>

3 Answers

Grace Kelly
Grace Kelly
33,990 Points

Hi Pedro, these code challenges can be very picky about the input they require. While your code works perfectly, the challenge wants to receive a prompt with "What day is it?" while you have given it a prompt with "What day is it ?". There is a space between your "it" and your "?", simply fix that and the challenge should pass :)

Hi guys. I was able to fix it. Thanks Grace it was exactly what you said. Sorry that i didn't explain what i wanted properly . I was still getting the input box to pop up but in the challenge it was outputing as wrong. Thanks all for the help. Cheers. Pedro.

Andreas Anastasiades
Andreas Anastasiades
2,916 Points

What's the issue here? Do you get the dialog?

add

document.write(answer);

To display the given data