Home » JavaScript Array shift() Method

JavaScript Array shift() Method

by Online Tutorials Library

JavaScript Array shift() method

The JavaScript array shift() method removes the first element of the given array and returns that element. This method changes the length of the original array.

Syntax

The shift() method is represented by the following syntax:

Return

The first element of an array.

JavaScript Array shift() method example

Let’s see an example to remove and return the first element of an array.

Example

Test it Now

Output:

AngularJS  

Next TopicJavaScript Array

You may also like