JS: Array.prototype.unshift
xArray.unshift(new1, new2, etc)
-
- Adds items to the beginning of array xArray.
- Return the new length.
// example of unshift const xx = [3]; const yy = xx.unshift(7, [8]); console.log(yy === 3); console.log(JSON.stringify(xx) === "[7,[8],3]");