To take input in JavaScript from user, use the
prompt
function.Here's how you do it:
const name = prompt('What is your name?');
// type in "Mike" and press "OK"
console.log(name); // Mike
prompt
function.Here's how you do it:
const name = prompt('What is your name?');
// type in "Mike" and press "OK"
console.log(name); // Mike