+ 1
what to if I want to check whether input was a number or not by javascript only.
I tried to write a code for it please mention the error. https://code.sololearn.com/WvXXEoU924jw/?ref=app
4 Réponses
+ 1
You can use
if (isNaN(x.value))
But for number only input, you should set your input as number
use
<input type="number" >
+ 1
Thanks @Calvin
+ 1
Always check commands on Mozilla document
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN
0
But I want in which part of javascript we learn about NaN type things?