+ 1
When i type alphabet in Monthly salary prompt input ,I want that an error should display. What should I have to do?
4 Respostas
+ 2
You need to check the value received from the prompt is number or not .you can use isNan which returns true for alphatbets
0
Bro please give an example 😅
0
x = prompt ('enter your salary');
x = x*1;
if (isNaN(x)) {
console.log('this is letters');
}
else {
console.log ('this is numbers!');
}
0
Thanks Bro 😊😄 ,