How can i have a input from a user..that i can use as my var; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i have a input from a user..that i can use as my var;

in JS i select var all the time... but i don't know how to take inputss from users... anyone plz...

24th Jul 2016, 3:42 PM
BAYAZID
BAYAZID - avatar
3 Answers
+ 4
Var red = prompt("what is your name") ; Var blue = alert ("hello"+ red) ; //this code means to take the name of the person and give an hello
24th Jul 2016, 11:25 PM
Ozii
Ozii - avatar
+ 1
I'm pretty sure that the prompt command saves the input as a string. So if you were asking for numbers to use in an equation, you would have to use the parseInt command.
27th Jul 2016, 5:45 PM
Ashton Scannell
Ashton Scannell - avatar
+ 1
no, I tried to make a website using prompt to calculate from any number the user of the website put in the squareroot and it works
10th Aug 2016, 6:56 AM
Jefta Pruim
Jefta Pruim - avatar