JavaScript: Array.prototype.unshift

By Xah Lee. Date: . Last updated: .
arrayX.unshift(new1, new2 etc)
Adds items to the beginning of array arrayX. Return the new length.
// example of unshift

const xx = [3];

const xy = xx.unshift(7, [8]);

console.log(xy === 3);

console.log(JSON.stringify(xx) === "[7,[8],3]");

JavaScript: Array, add/remove items

BUY
ΣJS
JavaScript in Depth

JS Obj Reference

Array

prototype