diff options
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Tests/builtins/Number/Number.parseInt.js | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp index c9f17b6ee1..5962b579cf 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -42,6 +42,7 @@ void NumberConstructor::initialize(GlobalObject& global_object) define_native_function(vm.names.isInteger, is_integer, 1, attr); define_native_function(vm.names.isNaN, is_nan, 1, attr); define_native_function(vm.names.isSafeInteger, is_safe_integer, 1, attr); + define_property(vm.names.parseInt, global_object.get(vm.names.parseInt), attr); define_property(vm.names.parseFloat, global_object.get(vm.names.parseFloat), attr); define_property(vm.names.EPSILON, Value(EPSILON_VALUE), 0); define_property(vm.names.MAX_VALUE, Value(NumericLimits<double>::max()), 0); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Number/Number.parseInt.js b/Userland/Libraries/LibJS/Tests/builtins/Number/Number.parseInt.js new file mode 100644 index 0000000000..18a1ed1faa --- /dev/null +++ b/Userland/Libraries/LibJS/Tests/builtins/Number/Number.parseInt.js @@ -0,0 +1,5 @@ +test("basic functionality", () => { + // Ensuring it's the same function as the global + // parseInt() is enough as that already has tests :^) + expect(Number.parseInt).toBe(parseInt); +}); |