JavaScript Built-in Constants Operations that return NaN

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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.



Got any JavaScript Question?