js determines input Whether it is a number
Note Ming: In JavaScript, to determine whether the content entered by the user is a number, we only need to use isNaN to determine it.
isNaN(numValue) The required numvalue parameter is the value to be checked whether it is NAN
If the value is NaN, then the isNaN function returns true, otherwise it returns false
The typical case of using this function is to check parseInt and The return value of the parseFloat method. Alternatively, a variable can be compared with itself. If the result of the comparison is not equal, then it is NaN . This is because NaN is the only value that is not equal to itself.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn