diff options
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r-- | Libraries/LibJS/Runtime/GlobalObject.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Tests/NaN-basic.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/GlobalObject.cpp b/Libraries/LibJS/Runtime/GlobalObject.cpp index c1a344df30..b45fb867ca 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -21,7 +21,7 @@ GlobalObject::GlobalObject() put_native_function("isNaN", [](Object*, Vector<Value> arguments) -> Value { if (arguments.size() < 1) return js_undefined(); - return Value(arguments[0].is_nan()); + return Value(arguments[0].to_number().is_nan()); }); put("Math", heap().allocate<MathObject>()); } diff --git a/Libraries/LibJS/Tests/NaN-basic.js b/Libraries/LibJS/Tests/NaN-basic.js index 94f271d35e..75ae62f16e 100644 --- a/Libraries/LibJS/Tests/NaN-basic.js +++ b/Libraries/LibJS/Tests/NaN-basic.js @@ -5,7 +5,7 @@ try { assert(nan + "" == "NaN"); assert(isNaN(nan) === true); assert(isNaN(0) === false); - assert(isNaN(undefined) === false); + assert(isNaN(undefined) === true); assert(isNaN(null) === false); console.log("PASS"); } catch (e) { |