Displaying Prompt Data

Click the button to answer a few questions.


Code Example

 <script>
  var ans1 = prompt("What's your name?", "");
  var ans2 = prompt("What city are you from?", "");
  var ans3 = prompt("What kind of work do you do?", "");
  var list = [ans1, ans2, ans3 ];
	
  function questions() {
    document.write("Welcome " + ans1 + " from " + ans2 + "." + " We value " + ans3 + " around here.");
    alert(list);
  }
 </script>