JavaScript Array shift()
Example
Remove the first item of an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
Try it Yourself »
There are more examples at the bottom of this tutorial.
Definition and Usage
The shift() method removes the first item of an array.
shift() returns the element it removes.
shift() changes the original array.
Tip: To remove the last item of an array, use pop().
Browser Support
shift() is fully supported in all browsers:
| Chrome | IE | Edge | Firefox | Safari | Opera |
| Yes | Yes | Yes | Yes | Yes | Yes |
Syntax
array.shift()
Parameters
| None |
Technical Details
| Return Value: | The removed array item. The item can be a string, a number, an array, an object, or any other type allowed in an array. |
|---|---|
| JavaScript Version: | ECMAScript 1 |
More Examples
Example
Array.shift() returns the removed array element:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift(); // Returns "Banana"
Try it Yourself »

