+ 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 ответов
+ 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