+ 3
Please help me fix my JS code
Any help will be appreciated Here is the code https://code.sololearn.com/W2izb2c5Q4us/#html
7 Respuestas
+ 1
Like this one?
Code:
function yourName() {
var b = false
while(b == false) {
userInput = prompt("What is your name? ")
if(userInput == "") {
alert("You didn't input anything!");
continue
}
find = userInput.replace(/[\D]/g, '')
if(find != "") {
alert("Your didn't contain a number!")
continue
}
b = true
}
alert("Hey there "+userInput+" !")
}
+ 4
try/catch block
+ 4
Thank you @Thomas Hj
this exactly what i wanted to code
I really a appreciate you all
+ 3
I want to alert the user when he/she enters a digit (0-9)
+ 3
Please check it out again
https://code.sololearn.com/W2izb2c5Q4us/#html
+ 2
You need to match the regex using
decimal = userInput.match(yourRegEx)
+ 2
Your welcome :)
I forget to add ' || userInput == null ' but I think you know where to be added in.