Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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");
console.log(first_name);  
var second_name = prompt("Please enter your second name");
console.log(second_name); 
var age = prompt("Please enter your age"); 
console.log(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!');
console.log(string); 
document.write(string);
Dave StSomeWhere
Dave StSomeWhere
19,822 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