summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibJS/Runtime/GlobalObject.cpp1
-rw-r--r--Libraries/LibJS/Tests/NaN-basic.js4
2 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/GlobalObject.cpp b/Libraries/LibJS/Runtime/GlobalObject.cpp
index 4c3b4daa55..c09c5ce3cd 100644
--- a/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -18,6 +18,7 @@ GlobalObject::GlobalObject()
put_native_function("gc", gc);
put_native_function("isNaN", is_nan);
+ put("NaN", js_nan());
put("console", heap().allocate<ConsoleObject>());
put("Date", heap().allocate<DateConstructor>());
put("Error", heap().allocate<ErrorConstructor>());
diff --git a/Libraries/LibJS/Tests/NaN-basic.js b/Libraries/LibJS/Tests/NaN-basic.js
index 75ae62f16e..a129564b42 100644
--- a/Libraries/LibJS/Tests/NaN-basic.js
+++ b/Libraries/LibJS/Tests/NaN-basic.js
@@ -3,7 +3,11 @@ function assert(x) { if (!x) throw 1; }
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);