Movatterモバイル変換


[0]ホーム

URL:


CodeQL documentation
CodeQL resources

Comparison with NaN

ID: js/comparison-with-nanKind: problemSecurity severity: Severity: errorPrecision: very-highTags:   - quality   - reliability   - correctness   - external/cwe/cwe-570   - external/cwe/cwe-571Query suites:   - javascript-code-quality.qls   - javascript-security-and-quality.qls

Click to see the query in the CodeQL repository

Arithmetic comparisons with the special not-a-number valueNaN are useless: nothing is considered to be equal toNaN, not evenNaN itself, and similarly nothing is considered greater or less thanNaN.

Recommendation

Use theisNaN function from the standard library to determine whether a given value isNaN.

Example

Instead ofx===NaN, useisNaN(x).

References


[8]ページ先頭

©2009-2026 Movatter.jp