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

Carl Harold Villarin
Carl Harold Villarin
1,688 Points

Hi, im stuck with #3 does it have to be like this? document.write("Tuesday)";

JavaScript Basics Challenge Task 3 of 3

scripts.js
var answer; answer= prompt("What day is it?");
document.write("Tuesday');
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

First off, your document.write() didn't work because you used 2 different quotations, you started the string with a " and ended it with a '. That doesn't work, they have to match. Second. You're supposed to put in the variable answer as the argument to document.write(), and not a string of the actual answer.

Wil Arter
Wil Arter
1,422 Points

Carl,

var answer;
answer = prompt("What day is it?");

document.write(answer);

The answer above worked, it does not have to be like your question above (document.write("Tuesday");), the output will need to have the value of the variable 'answer' this is used as the above you are getting the input from the user to output the answer they gave, not to 'hard code' the output in.