📌  相关文章
📜  从数组javascript代码示例中删除第一个元素

📅  最后修改于: 2022-03-11 15:02:26.405000             🧑  作者: Mango

代码示例6
var myarray = ["item 1", "item 2", "item 3", "item 4"];

//removes the first element of the array, and returns that element.
alert(myarray.shift());
//alerts "item 1"

//removes the last element of the array, and returns that element.
alert(myarray.pop());
//alerts "item 4"