function myFunction() { var x; var name=prompt("Please enter your name","Sean Reek"); var age=prompt("Please enter your name","16"); if (name!=null && age!=null) //if name isn't null(nothing, 0) { x="My name is " + name + " and i'm " + age + " years old."; document.getElementById("demo").innerHTML=x; //writes the text from "x" on your page where the "demo" id is placed } }