+ 1

When i type alphabet in Monthly salary prompt input ,I want that an error should display. What should I have to do?

https://code.sololearn.com/W3DxUvQfP2hN/?ref=app

24th Dec 2019, 6:01 PM
Yash Robin
Yash Robin - avatar
4 odpowiedzi
+ 2
You need to check the value received from the prompt is number or not .you can use isNan which returns true for alphatbets
24th Dec 2019, 6:22 PM
Rajith kumar Shetty
Rajith kumar Shetty - avatar
0
Bro please give an example 😅
24th Dec 2019, 9:53 PM
Yash Robin
Yash Robin - avatar
0
x = prompt ('enter your salary'); x = x*1; if (isNaN(x)) { console.log('this is letters'); } else { console.log ('this is numbers!'); }
25th Dec 2019, 5:26 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Thanks Bro 😊😄 ,
25th Dec 2019, 5:56 AM
Yash Robin
Yash Robin - avatar