+ 2
Prompt/display
Need help. I want a prompt to ask what’s your name, then I want welcome (name)
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
0
Was this not good enough to get you started?
https://www.sololearn.com/discuss/1400568/?ref=app
0
Janning⭐ no i just needed to post 2 Q&A’s
0
Why?
0
Janning⭐ idk