JavaScript NaN Function18 Mar 2025 | 4 min read JavaScript's number feature enables you to represent numeric and floating numbers. JavaScript number has a particular value called NaN function, which means for Not-a-Number. NaN is an attribute of the global javascript object. The global object is used to show the window object in web browsers. There are used to NaN function in different ways.
SyntaxJavaScript provides us with the global function isNaN(). It returns true if its argument is NaN of the operation. The NaN function shows the true or false output of the given syntax. ExamplesThe following example shows multiple types of the number or NaN values using javascript. Example 1: The given an example shows NaN number in javascript using different display values. Here, we use positive, negative, and simple equation data. Output You can see the Boolean format data to check input value is NaN. ![]() Example 2: The given example shows NaN number in javascript using different display values. Here, we use number, string, equation, and date format input value. Output You can see the Boolean format data to check input value is NaN. ![]() Example 3: The given an example shows NaN numbers in javascript using different display values here. It uses positive, negative, and simple equation data. We can use a different method to check given number is Nan or not. Output You can see the Boolean format data to check input value is NaN. ![]() Example 4: The given an example shows NaN number in javascript using different display values. Here, we use other functions such as parseInt and parseFloat. Output You can see the Boolean format data to check input value is NaN. ![]() Example 5: The given example shows the NaN number in the javascript equation and other functions using different display values. Output You can see the Boolean format data to check input value is NaN. ![]() Why use the NaN FunctionJavaScript NaN function shows the result of a failed operation on numbers, including:
Supported BrowserThe following browser is used and supports the javascript NaN function. Almost all browsers and the latest version are supported by the NaN function.
ConclusionThe NaN() function is used to get or check given number is NaN or not using javascript. It is a global function to work with all types of data. Next TopicJavaScript onbeforeunload Event |
The JavaScript textContent property works to set and get the page's text content. It is used to pass and display the text content of some information, tags, and large size of data and its nodes. The TextContent varies from the nodeValue of the script tag...
5 min read
We can remove single or multiple data in the database using the javascript indexedDB function. We can use the key value or id to remove the entire database row. The procedure of the delete data into javascript indexedDB The below procedure steps help to delete information. To...
3 min read
Nowadays, almost all web-developers use JavaScript in their web-pages. JavaScript is a client-side scripting language that runs on a client machine (such as a web-browser). It helps web-developers to create modern web-pages that allow users to interact directly with the web-pages, without reloading them. If...
5 min read
Javascript getModifierState() KeyboardEvent uses to know which keypresses are on the keyboard. The event returns true if modifiers keys are pressed or clicked off the keyboard. We can use the pressed, clicked key, and the keyboard event activates the function. Syntax The syntax uses the javascript tag...
3 min read
In this chapter, you will learn how to generate random images on a webpage with the help of JavaScript. So, we will create different random image generator using JavaScript and HTML source code. Firstly, it requires an array to contain the URLs of images to...
8 min read
The JavaScript change event is an event type that gets executed when the focus on an element is changed. The change event of JavaScript inherits all the methods and properties of the Event. Here, in this section, we will understand and implement the practical use of...
5 min read
The output of raising a first input value to the power of the second input value is returned by the exponentiation (**) operator. It is the same as Math.pow(), except that it also accepts BigInts as operands. The javascript exponentiation operator is used to calculate the...
5 min read
JavaScript supports comparison operators to compare two values. The JavaScript comparison operators take two values, compare them, and return a Boolean result, either true or false. These operators are very useful in decision-making and loop programs in JavaScript. In programming languages, the operators are used to...
5 min read
? There are many ways to call a JavaScript function in the HTML document, and it is also not a difficult task. First, we have used one of the easiest ways to call a JavaScript function in HTML document: In this method, we will create and define...
3 min read
is a DOM property of JavaScript that allows for styling the CSS (Cascading Style Sheet) classes of an element. is a read-only property that returns the names of the CSS classes. It is a property of JavaScript with respect to the other properties...
5 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India