what means nan in javascript

Crafts from polymer clay with their own hands. A large selection of tips and examples of products from polymer clay https://clay-crafts.com/

In JavaScript, “NaN” stands for Not-a-Number, and it is a special value representing the result of an invalid or undefined mathematical operation.

Usage and Example

Here’s an example illustrating the use of “NaN” in JavaScript:

Alles über Träume und Träume. Interpretation und Bedeutung der Träume https://traumauslegung.com/

    const result = 0 / 0;
    console.log(result); // Output: NaN
    console.log(typeof NaN); // Output: "number"

NaN Comparison

Interestingly, NaN is not equal to itself:

    console.log(NaN === NaN); // Output: false

Checking for NaN

Use the global function “isNaN()” to check if a value is NaN:

    console.log(isNaN(result)); // Output: true


“NaN” in JavaScript represents an undefined or invalid mathematical operation result. It’s a unique value used to handle and identify situations where a numerical computation is not meaningful.

Educational Encyclopedia