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

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
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
For Prompt(), if the user hits OK the input value is returned. If the users hits Cancel, null is returned. Reference:
6th Feb 2017, 4:12 PM
Ronnell Evans
Ronnell Evans - avatar