I mean it's the opposite of shift() , so if you're struggling to remember what it does, maybe that's a useful cognitive hook to hang it on? Answer from pookage on reddit.com
🌐
W3Schools
w3schools.com › jsref › jsref_unshift.asp
JavaScript Array unshift() Method
The unshift() method overwrites the original array. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › unshift
Array.prototype.unshift() - JavaScript | MDN
The unshift() method reads the length property of this. It shifts all indices in the range 0 to length - 1 right by the number of arguments (incrementing their values by this number). Then, it sets each index starting at 0 with the arguments passed to unshift().
🌐
CodingNomads
codingnomads.com › javascript-array-unshift-shift-pop-push
JavaScript Array Essentials: Using pop, push, shift, and unshift
Next, the shift() method is used, ... being performed on the array - one "shifts" elements out of the array, while the other "unshifts" or pushes elements into the array from the start....
🌐
Career Karma
careerkarma.com › blog › javascript › javascript shift and javascript unshift: a complete guide
JavaScript Shift and JavaScript Unshift: A Complete Guide
December 1, 2023 - This tutorial will explore how to use shift() and unshift() to remove and add items to the start of an array. In addition, we’ll walk through an example of each of these functions in a JavaScript program.
🌐
Medium
medium.com › an-idea › javascript-arrays-push-pop-shift-unshift-adc8fb815fc0
JavaScript Arrays: push(), pop(), shift() & unshift() | by Amanda M Johnson | An Idea (by Ingenious Piece) | Medium
October 10, 2021 - When working with arrays, it is important to understand the different types of methods and how they transform your data. push(), pop(), shift() and unshift() are only four of many other such methods. ... relies on the length property to know where to insert the new element(s) and will default to 0 if there is no length
🌐
Reddit
reddit.com › r/learnjavascript › who thought "unshift()" was a good name? why?
r/learnjavascript on Reddit: Who thought "unshift()" was a good name? Why?
December 20, 2023 -

EDIT: This is just venting, not confusion on how the word is technically used by JS :D

OK, this is why I keep starting and stopping learning JS- reserved words with extremely unrelated English meanings. "Unshift" means a previous shift occurred. That's the only meaning for it in English. But JS decided to use it as a prepend array method. Argh!!

That is all...

Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › shift
Array.prototype.shift() - JavaScript | MDN
The shift() method shifts all values to the left by 1 and decrements the length by 1, resulting in the first element being removed.
🌐
Medium
omken.medium.com › javascripts-push-pop-shift-and-unshift-array-methods-with-respect-to-big-o-notation-e129ac5464
JavaScript’s Push, Pop, Shift, and Unshift Array Methods With Big O Notation. | by Omkesh B. Kendre | Medium
November 28, 2022 - The sample programming shown below will help you to understand the Big O complexities of the push(), pop(), shift(), and unshift() functions. let finalArray = []; finalArray.length = 10000000; var time1 = performance.now(); finalArray.push(1) var time2 = performance.now(); console.log(`Time calculated push(): ${(time2 - time1) / 1000} seconds.`) var time3 = performance.now(); finalArray.unshift(1) var time4 = performance.now(); console.log(`Time calculated unshift(): ${(time4 - time3) / 1000} seconds.`) var time5 = performance.now(); finalArray.pop() var time6 = performance.now(); console.log(`Time calculated pop(): ${(time6 - time5) / 1000} seconds.`) var time7 = performance.now(); finalArray.shift() var time8 = performance.now(); console.log(`Time calculated shift(): ${(time8 - time7) / 1000} seconds.`) /** Result: Time calculated push(): 0.012700000047683716 seconds.
🌐
Linux Hint
linuxhint.com › javascript-array-shift-and-unshift-method
JavaScript Array Shift and Unshift Method
Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
Medium
developerchandan.medium.com › mastering-array-manipulation-in-javascript-exploring-pop-push-shift-unshift-splice-and-slice-c0ebaf3b004c
“Mastering Array Manipulation in JavaScript: Exploring pop, push, shift, unshift, splice, and slice Methods” | by Chandan Kumar | Medium
June 2, 2023 - 3. shift():-The shift() method removes the first element from an array and returns that element. let fruits = ['apple', 'banana', 'orange']; let removedFruit = fruits.shift(); console.log(removedFruit); // Output: 'apple' console.log(fruits); ...
🌐
TechBytes
mundrisoft.com › home › ui/ux development › javascript › javascript: what is the difference between shift() and unshift() array methods?
JavaScript: What is the difference between shift() and unshift() array methods?
April 11, 2019 - Definition: shift(): this method is use to remove first element of an array and returns new array. unshift(): this array method is used to add one or more arrays in existing array list and returns new array. usages of shift(): //JavaScript: ...
🌐
Reddit
reddit.com › r/learnjavascript › the four common javascript array methods push, pop, shift and unshift
r/learnjavascript on Reddit: The four common Javascript array methods Push, Pop, Shift and Unshift
May 16, 2020 -

Javascript has a number of methods related to arrays which allow programmers to perform various array operations. There are four methods which are particularly used for adding and removing elements to and from an array. They are: push(), pop(), shift() and unshift(). For an experienced as well as new programmers, its likely to sometimes get confused how each of them work and which one to use in which situation. Thus, in this article, we have tried to simplify the concept with pictures and examples. Let's start exploring them one by one. Then we will compare their similarities and differences. Please look at the pictures too for better understanding.

https://foxbits.dev/article/four-common-javascript-array-methods-push-pop-shift-and-unshift/15

🌐
Bennadel
bennadel.com › blog › 1796-javascript-array-methods-unshift-shift-push-and-pop.htm
Javascript Array Methods: Unshift(), Shift(), Push(), And Pop()
April 21, 2020 - Javascript also has support for parallel methods that work on the beginning of the array, where the index is smallest. Unshift() and shift() are basically the same as push() and pop(), only, at the other end of the array.
🌐
DEV Community
dev.to › shubhamtiwari909 › array-method-in-js-shift-and-unshift-48bn
Array Method in JS - shift and unshift - DEV Community
September 5, 2022 - const array = [1,2,3,4,5]; const array2 = ["This","is","array2"] array.unshift(6) //single element insertion array.unshift(7,8,9) // multiple element insertion array.unshift("BOOTSTRAP5") // string element insertion array.unshift("TAILWINDCSS","REACT JS") //multiple string element insertion array.unshift([10,11]) // number array insertion array.unshift(["NODE JS","MONGO DB"]) // string array insertion array.unshift([[12,13],[14,15]]) // 2-d array insertion array.unshift({name:"shubham",age:21}) // Object insertion array.unshift(array2) // array stored in a variable then inserted array.unshift(undefined,null) // undefined and null insertion array.unshift(true,false) // Boolean insertion array.unshift(array) // [Circular *1] console.log(array) array.shift() // pop out the first element array.shift() // pop out the first element console.log("\n\nAfter shifting 2 times") console.log(array)
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › what-is-the-difference-between-unshift-and-push-method-in-javascript
What is the difference between unshift() and Push() method in JavaScript? - GeeksforGeeks
July 23, 2025 - JavaScript Unshift() method is very much similar to the push() method but the difference is that the unshift() method adds the elements at the very beginning of the array whereas the push() method adds at the end of the array.
🌐
Suneet Agrawal
agrawalsuneet.github.io › blogs › array-operations-in-javascript-push-pop-shift-unshift
Array Operations in JavaScript (Push, Pop, Shift and Unshift) · Suneet Agrawal
We then use the shift() method to remove the first element from the array. The removed element is stored in the removedElement variable, and the resulting array has two elements. The unshift() method is used to add one or more elements to the beginning of an array.