summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/GlobalObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-27 12:59:41 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-27 12:59:41 +0100
commit6a5cd32205dab3e2764fe59243862e4b9094bc67 (patch)
treee58fce645cb60e7597e15fd1e30811488b07a01c /Libraries/LibJS/Runtime/GlobalObject.cpp
parentc60dc84a333a85bd859d284cea72b9c02682a392 (diff)
downloadserenity-6a5cd32205dab3e2764fe59243862e4b9094bc67.zip
LibJS: The global isNaN() should coerce to number before testing NaN
For stricter NaN checking, we'll have to implement Number.isNaN().
Diffstat (limited to 'Libraries/LibJS/Runtime/GlobalObject.cpp')
-rw-r--r--Libraries/LibJS/Runtime/GlobalObject.cpp2
1 files changed, 1 insertions, 1 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>());
}