ladybird/Base/home/anon/js/array.js
Andreas Kling bceabd7c4b 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.
2020-03-20 21:56:40 +01:00

11 lines
168 B
JavaScript

var a = [1, 2, 3];
a[1] = 5;
var push_result = a.push(7);
for (var i = 0; i < a.length; ++i) {
console.log(a[i]);
}
console.log("push result: " + push_result);