Prompt/display | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Prompt/display

Need help. I want a prompt to ask whatā€™s your name, then I want welcome (name)

12th Jul 2018, 2:50 PM
Ryan Sullivan
Ryan Sullivan - avatar
5 Answers
+ 3
Maybe something like this? var usr = prompt("Hi what's your name?") if(usr === null) { // Cancel button was selected alert("You haven't told me your name") } else { if(usr.length) { alert("Welcome " + usr) } else { // Input is empty string alert("You gave me nothing!") } } Hth, cmiiw
12th Jul 2018, 4:46 PM
Ipang
0
Was this not good enough to get you started? https://www.sololearn.com/discuss/1400568/?ref=app
12th Jul 2018, 8:41 PM
Janningā­
Janningā­ - avatar
0
Janningā­ no i just needed to post 2 Q&Aā€™s
12th Jul 2018, 8:43 PM
Ryan Sullivan
Ryan Sullivan - avatar
0
Why?
12th Jul 2018, 8:43 PM
Janningā­
Janningā­ - avatar
12th Jul 2018, 8:45 PM
Ryan Sullivan
Ryan Sullivan - avatar