Nucleus handler tools › Docs › Checks

A comparison with NaN

Warninguse-isnanA general JavaScript mistake (ESLint's use-isnan) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

Nothing equals NaN, not even NaN: this comparison is always false. Use isNaN(x).

Example

✗ Wrong

var n = Number("x");
if (n == NaN) {
}

✓ Right

var n = Number("x");
if (isNaN(n)) {
}

How to fix it

Use isNaN(x).

Turn it off, or change how it shows

Each check can be shown as an error, warning, info or hint, or turned off. VS Code: "splitscreenme.lint.rules": { "use-isnan": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule use-isnan=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop