What is isNaN in javascript

藏色散人
Release: 2022-01-18 11:40:05
Original
6813 people have browsed it

javascript's isNaN is a built-in function used to check whether its parameter is a non-numeric value. Its usage syntax is "isNaN(value)", and the parameter value specifies the value to be detected.

What is isNaN in javascript

The operating environment of this article: Windows 7 system, javascript version 1.8.5, Dell G3 computer.

What is isNaN of javascript?

isNaN() function is used to check whether its argument is a non-numeric value.

If the parameter value is NaN or a non-numeric value such as a string, object, or undefined, it will return true, otherwise it will return false.

Syntax

isNaN(value)
Copy after login

Parameters

value required. The value to detect.

All major browsers support isNaN() function

Example

Check whether the number is illegal:

document.write(isNaN(123)+ "<br>");
document.write(isNaN(-1.23)+ "<br>");
document.write(isNaN(5-2)+ "<br>");
document.write(isNaN(0)+ "<br>");
document.write(isNaN("Hello")+ "<br>");
document.write(isNaN("2005/12/12")+ "<br>");
Copy after login

The output result of the above example:

false
false
false
false
true
true
Copy after login

Recommended learning: "js Basic Tutorial"

The above is the detailed content of What is isNaN in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!