Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to console.log while using a prompt in javascript

var name = prompt("Name?");
console.log("Hello " + name);

// Force a 10 millisecond delay before running the rest of the code.
setTimeout(function(){
  var age = prompt("Age?");
  console.log(name + " is " + age + " years old");
}, 10);
 
PREVIOUS NEXT
Tagged: #prompt #javascript
ADD COMMENT
Topic
Name
4+8 =