summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-22 17:34:52 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-23 00:02:13 +0200
commit6a4280e6e52533a9fc242826dacd91c1c43142c8 (patch)
tree7b94d9701e2d98035964b6e7b9254270b78e6cea /Libraries/LibJS/Runtime
parenta3e4dfdf9859a9b955bf4728328f740a47de5851 (diff)
downloadserenity-6a4280e6e52533a9fc242826dacd91c1c43142c8.zip
LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined
Diffstat (limited to 'Libraries/LibJS/Runtime')
-rw-r--r--Libraries/LibJS/Runtime/ArrayPrototype.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
index ecd14217c1..edfa930ed2 100644
--- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp
+++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
@@ -357,7 +357,7 @@ Value ArrayPrototype::index_of(Interpreter& interpreter)
return {};
i32 array_size = static_cast<i32>(array->elements().size());
- if (interpreter.argument_count() == 0 || array_size == 0)
+ if (array_size == 0)
return Value(-1);
i32 from_index = 0;
@@ -411,7 +411,7 @@ Value ArrayPrototype::last_index_of(Interpreter& interpreter)
return {};
i32 array_size = static_cast<i32>(array->elements().size());
- if (interpreter.argument_count() == 0 || array_size == 0)
+ if (array_size == 0)
return Value(-1);
i32 from_index = 0;