Dec 9, 2023 · 1 min read · unshift Add an element to the front of an array Array.prototype._unshift = function(...values) { const newArray = [...values, ...this] this.length = 0 this.push(...newArray) return this.length; }; const fruits = ['apple', 'mango', 'banana']...
Join discussion
Dec 8, 2022 · 4 min read · It is the third article from the polyfill series. If you haven't read the previous article in this polyfill series then you can find those articles here Push Polyfill Pop Polyfill Today we will learn about the polyfill of the array unshift method. Th...
AAnand commented