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!

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 The Variable Challenge

i almost had it right !!

all of it works execept i cant get it to display on the browser by combining all the strings , is the way im doing it is i ask the questions and store the answers in comand.log but i want to display all of the answers and strings with document.write() is there a way to do so ?? here is my code : var story= prompt("what is your name ?"); console.log(story); var want=prompt("and you wanna become?"); console.log(want); var mission=prompt("and your mission is ?") console.log(mission); alert("you have compleated the story"); Document.write("our hero+story+will become+want+and his mission is to+mission");

2 Answers

This works for me in the console. Not the most exciting script but basics work ok.

var first_name = window.prompt("Please enter your first name");
var second_name = prompt("Please enter your second name");
var age = prompt("Please enter your age"); 
console.log(alert("Thanks! You're now complete and free to go!")); 
var string = ('Hi ' + first_name + ' I can\'t believe you are ' + age + '. It has been so long since we last spoke!');
Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Try just using a lower case 'd' for document.write().

You'll also need to fix the formatting of that line to show the variable values - right now it is just 1 long string.

MDN document.write