0
How can you access the result of a prompt box?
Hi, I'm just learning JavaScript and I was wondering if there is a way to access what the user inputs into a prompt box and if so, how do you do it?
3 Answers
+ 12
var x = prompt("enter something")
console.log(x) // whatever the user inputted is inside x now as a string
+ 4
var variable = prompt(text, defaultText);
^That'll store the inputted value into the variable so you can use their inputted data.
+ 1
Thanks guys