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 trialmoustafa ahmed
1,215 Pointsvar date = prompt("What day is it? ") var answer = (date); document.write(answer); whats wrong cant understand
i dont know what wrong with my code i even try it out and run it its work just fine
var date = prompt("What day is it? ")
var answer = (date);
document.write(answer);
<!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>
moustafa ahmed
1,215 Pointsi have to print whats come out from the prompt so var date = prompt ("what is the date"); document .write(date);
its the same as
var date = prompt ("what is the date"); var answer = (date); document.write(answer); but i figure out that the site didnt figure out that both of them are right its ok already solve it :) thanks much
1 Answer
Steven Parker
231,269 PointsThe instructions for task 2 say, "Use the prompt() method to ask the user "What day is it?" and store the result in the answer variable." but you're storing it in a different variable named date and then copying again on the next line.
Also, the challenges are very picky about exact outputs and you have an extra space after the question mark in the prompt string.
franklin Kirimi
898 Pointsfranklin Kirimi
898 PointsI think your problem might be on line 2 of your scripts.js. hint: what type of data are you storing in var answer?