JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Eduardo Jonathan Munoz
Eduardo Jonathan Munoz
6,672 Points

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,820 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