Blogger Information
Blog 13
fans 0
comment 0
visits 10481
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
用splice()实现数组的增删改查
PHPer博客
Original
1097 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用splice()实现数组的增删改查</title>
</head>
<body>
<script>
    // 语法:arrayObject.splice(index,howmany,item1,.....,itemX)

    var arr=['html','css','php','TP6.0'];

    arr.splice(2,0,'javascript');  //在键值为2的前面删除了0个属性值,增加了‘javascript’

    arr.splice(1,1);  //删除了‘css’

    arr.splice(3,1,'TP5.1');  //把TP6.0改成了TP5.1

    document.write(arr);  //把结果输出到浏览器上显示

</script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post