mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 17:16:04 +00:00
LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined
This commit is contained in:
parent
a3e4dfdf98
commit
6a4280e6e5
Notes:
sideshowbarker
2024-07-19 06:14:40 +09:00
Author: https://github.com/linusg
Commit: 6a4280e6e5
Pull-request: https://github.com/SerenityOS/serenity/pull/2332
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