mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 15:42:52 +00:00
LibJS: Add ArrayPrototype and implement Array.prototype.push()
This function is ultimately supposed to be generic and allow any |this| that has a length property, but for now it only works on our own Array object type.
This commit is contained in:
parent
8f7d4f67a4
commit
bceabd7c4b
Notes:
sideshowbarker
2024-07-19 08:12:37 +09:00
Author: https://github.com/awesomekling
Commit: bceabd7c4b
9 changed files with 110 additions and 4 deletions
|
@ -2,6 +2,10 @@ var a = [1, 2, 3];
|
|||
|
||||
a[1] = 5;
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var push_result = a.push(7);
|
||||
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
console.log(a[i]);
|
||||
}
|
||||
|
||||
console.log("push result: " + push_result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue