js array shift() method

The shift() method is to move the first element of an array out

var arr = [1,2,3,4,5];
var b = arr.shift();
console.log(b)
 1
take the first element
console.log(arr)
 [2, 3, 4, 5]
Array after removing the first element

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326840446&siteId=291194637