mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +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)
|
if (index.has_overflow() || index.value() >= length)
|
||||||
return js_undefined();
|
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