Return value of prompt function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Return value of prompt function

Does it return the value of input data or a boolean value whether it is stored or not.(as OK and Cancel)

22nd Sep 2016, 9:37 AM
Dhruv Walia
Dhruv Walia - avatar
2 Answers
0
I Didn't Really Understand The Question,But I Think You're Talking About Getting The Input From The Prompt Box. All You Have To Do Is Just Store The prompt() Function In A Variable: var prompt_window=prompt("What's Your Name?",""); Then Use That Variable However You Like To Get The Input.
2nd Oct 2016, 2:08 PM
Syrian Lucianos
Syrian Lucianos - avatar
0
For Prompt(), if the user hits OK the input value is returned. If the users hits Cancel, null is returned. Reference: http://www.w3schools.com/jsref/met_win_prompt.asp
6th Feb 2017, 4:12 PM
Ronnell Evans
Ronnell Evans - avatar