JavaScript Operations that return NaN


Example

Mathematical operations on values other than numbers return NaN.

"a" + 1
"b" * 3
"cde" - "e"
[1, 2, 3] * 2

An exception: Single-number arrays.

[2] * [3]  // Returns 6

Also, remember that the + operator concatenates strings.

"a" + "b"  // Returns "ab"

Dividing zero by zero returns NaN.

0 / 0         // NaN

Note: In mathematics generally (unlike in JavaScript programming), dividing by zero is not possible.