/

HTML / CSS / JavaScript Tutorial

JavaScript Array method: shift()

[this page | pdf | back links]

The shift() method (when applied to a JavaScript array) removes the first element of the array and returns that element.

 

It has the following syntax with no parameters. It returns the relevant object or primitive that was at the relevant place in the original array.

 

array.shift()

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Arrays


Desktop view | Switch to Mobile