Skip to content

Files

Latest commit

 

History

History
13 lines (7 loc) · 436 Bytes

use-isnan.md

File metadata and controls

13 lines (7 loc) · 436 Bytes

Pattern: Invalid NaN comparison

Issue: -

Description

Enforces use of the isNaN() function to check for NaN references instead of a comparison to the NaN constant.

Rationale: Since NaN !== NaN, comparisons with regular operators will produce unexpected results. So, instead of if (myVar === NaN), do if (isNaN(myVar)).

Further Reading