JavaScript isNaN

isNaN JavaScript

JavaScript isNaN function determines whether the value passed as an argument is not a number.

The syntax is therefore the following: isNaN(value).

The function returns a Boolean value that is true if the argument passed is not a number, otherwise it returns false.

JavaScript isNaN – examples

In all the examples presented under the isNaN function gives true:

isNaN('13 01 20');

Instead in these other cases it has false value:


As we can see therefore even if I pass the empty string it gives false as a result, as if it were a number.

Furthermore, even if we pass a number as a string, it always returns false, as in the example below:

var num = '13';

In the browser console we will display false, because the variable num is interpreted as a number.

Some useful links

JavaScript tutorial

JavaScript Calculator

Object in JavaScript

For in loop

Caesar cipher decoder

Slot Machine in JavaScript

Introduction to JavaScript language

Learn JavaScript – basic concepts

Leave a Reply

Your email address will not be published. Required fields are marked *