JavaScript: Array.prototype.unshift
arrayX.unshift(new1, new2 etc)
- Adds items to the beginning of array arrayX. Return the new length.
const ar = [3]; console.log( ar.unshift(7, [8]) ); // 3 console.log( ar ); // [7, [ 8 ], 3]
arrayX.unshift(new1, new2 etc)
const ar = [3]; console.log( ar.unshift(7, [8]) ); // 3 console.log( ar ); // [7, [ 8 ], 3]