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
Unsubscribed User
17,284 PointsNeed Help. Use the document.write() method to write the variable answer to the page.
Forgive the bare bones basic question here but I'm new to Javascript. The question on the quiz is listed in the title. This is my answer and it's wrong. Can someone help me please. I went through the video and could not find a situation where the instructor used this method. Thanks.
var answer = prompt ("What day is it?")
document.write ("answer");
5 Answers
Luke Glazebrook
13,564 PointsHi Dana!
Make sure that you aren't putting answer in quotation marks because then JavaScript will read it as a string instead of a variable!
Also, try to remember to end your lines with semi-colons!
I hope this was helpful.
-Luke
Unsubscribed User
17,284 PointsThanks Luke...this amazingly worked ;)
var answer = prompt ("What day is it?");
document.write (answer);
Luke Glazebrook
13,564 PointsGreat! I'm glad you managed to get it working. Enjoy the rest of JavaScript.
Tapiwa Chiwara
5,981 PointsI've tried this one and it worked
var answer = prompt ("What day is it?"); document.write (answer);
Don Crowley
Courses Plus Student 3,092 PointsI am using
prompt ("What day is it?");
var answer = prompt ("What day is it?");
document.write (answer);
and it's failing
Bummer! It looks like you placed the document.write() function in the wrong place
What am I doing wrong?
LaRenzo DeGraffenreidt
10,159 PointsTake out the
prompt ("What day is it?");
and keep the next two lines. That seemed to be the key.