1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 16:25:07 +00:00
serenity/Libraries/LibJS/Tests/NaN-basic.js
Andreas Kling 6a5cd32205 LibJS: The global isNaN() should coerce to number before testing NaN
For stricter NaN checking, we'll have to implement Number.isNaN().
2020-03-27 12:59:41 +01:00

13 lines
318 B
JavaScript

function assert(x) { if (!x) throw 1; }
try {
var nan = undefined + 1;
assert(nan + "" == "NaN");
assert(isNaN(nan) === true);
assert(isNaN(0) === false);
assert(isNaN(undefined) === true);
assert(isNaN(null) === false);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}