shift()method removes the first element from an array and returns that element.
Syntax
array.shift();
Return Value
Returns the removed single value of the array.
Example
var arr = [10, 1, 2, 3].shift(); console.log("Shifted value is : " + arr );
On compiling, it will generate the same code in JavaScript.
Its output is as follows −
Shifted value is : 10
Previous Page:-Click here