DEV Community

Jack Pritom Soren
Jack Pritom Soren

Posted on

4 2

JavaScript Array Methods : Shift()

The shift() method removes the first element from an array and returns that removed element. This method changes the length of the array.

const array1 = [1, 2, 3];

const firstElement = array1.shift();

console.log(array1);
//output: Array [2, 3]

console.log(firstElement);
//output: 1

Enter fullscreen mode Exit fullscreen mode

Shift

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more