summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/NaN-basic.js
blob: 188d9347e36755880e8a0ac9c5a44fd2c81e3426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
load("test-common.js");

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