Open1

javaScript shift()の使い方

どるあがどるあが
var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];

console.log('myFish before:', JSON.stringify(myFish));
// myFish 処理前: ['angel', 'clown', 'mandarin', 'surgeon']

var shifted = myFish.shift();

console.log('myFish 処理後:', myFish);
// myFish 処理後: ['clown', 'mandarin', 'surgeon']

console.log('取り除いた要素:', shifted);
// 取り除いた要素: angel