mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:17:35 +00:00
LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined
This commit is contained in:
parent
a3e4dfdf98
commit
6a4280e6e5
3 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue