User input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

User input

How do I get user input without using prompt (on JS)?

31st Jan 2019, 1:51 PM
Raphael von Alchemy
Raphael von Alchemy - avatar
3 Answers
+ 1
prompt(message, default_value) is used to get inputs like strings or numbers confirm(message) for booleans, yes/no kind of input examples: name = prompt("What is your name"); likesMeat = confirm("do you like meat?");
31st Jan 2019, 2:13 PM
voidneo
0
So, I'm having problems getting number inputs, since the numbers i get through prompt are considered strings.
31st Jan 2019, 4:30 PM
Raphael von Alchemy
Raphael von Alchemy - avatar
0
Nvm, i already figured it out, i were using threatening them as strings 😅
31st Jan 2019, 4:38 PM
Raphael von Alchemy
Raphael von Alchemy - avatar