mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibJS: Make Array.prototype.at return undefined on empty slot
This commit is contained in:
parent
6c13cc67c6
commit
2d87d5dab9
1 changed files with 1 additions and 1 deletions
|
@ -1486,7 +1486,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::at)
|
|||
}
|
||||
if (index.has_overflow() || index.value() >= length)
|
||||
return js_undefined();
|
||||
return this_object->get(index.value());
|
||||
return this_object->get(index.value()).value_or(js_undefined());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue