JavaScript array.shift()方法从数组中删除第一个元素并返回该元素。
array.shift();
返回数组中删除的单个值。
链接:https://www.learnfk.comhttps://www.learnfk.com/javascript/array-shift.html
来源:LearnFk无涯教程网
<html> <head> <title>JavaScript Array shift Method</title> </head> <body> <script type="text/javascript"> var element=[105, 1, 2, 3].shift(); document.write("Removed element is : " + element ); </script> </body> </html>
运行上面代码输出
Removed element is : 105
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)