mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Make Array.prototype.at return undefined on empty slot
This commit is contained in:
parent
6c13cc67c6
commit
2d87d5dab9
Notes:
sideshowbarker
2024-07-18 12:16:13 +09:00
Author: https://github.com/davidot
Commit: 2d87d5dab9
Pull-request: https://github.com/SerenityOS/serenity/pull/8025
Reviewed-by: https://github.com/linusg
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