.shift()
shift()メソッドは配列から最初の要素を削除して、その要素を返します。このメソッドは配列のlengthを変更します。
arr.shift()
例
var myFish = ["angel", "clown", "mandarin", "surgeon"];
console.log("myFish before: " + myFish);
var shifted = myFish.shift();
console.log("myFish after: " + myFish);
console.log("Removed this element: " + shifted);
結果
myFish before: angel,clown,mandarin,surgeon
myFish after: clown,mandarin,surgeon
Removed this element: angel