1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:57:44 +00:00

LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined

This commit is contained in:
Linus Groh 2020-05-22 17:34:52 +01:00 committed by Andreas Kling
parent a3e4dfdf98
commit 6a4280e6e5
3 changed files with 7 additions and 2 deletions

View file

@ -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;