码迷,mamicode.com
首页 > Web开发 > 详细

js splice()

时间:2019-08-15 14:28:06      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:object   json   log   one   dex   john   array   tin   code   

//arrayObject.splice(index,howmany,item1,.....,itemX) 语法
//测试代码
let array;
array = [‘George‘,‘John‘,‘Thomas‘,‘James‘,‘Adrew‘,‘Martin‘];
cc.log(‘array = ‘ + jsonencode(array));
array.splice(1,0,‘gmk‘);
cc.log(‘array = ‘ + jsonencode(array));

array = [‘George‘,‘John‘,‘Thomas‘,‘James‘,‘Adrew‘,‘Martin‘];
cc.log(‘array = ‘ + jsonencode(array));
array.splice(1,1);
cc.log(‘array = ‘ + jsonencode(array));

//测试代码log
//array = ["George","John","Thomas","James","Adrew","Martin"]
//array = ["George","gmk","John","Thomas","James","Adrew","Martin"]
//array = ["George","John","Thomas","James","Adrew","Martin"]
//array = ["George","Thomas","James","Adrew","Martin"]

js splice()

标签:object   json   log   one   dex   john   array   tin   code   

原文地址:https://www.cnblogs.com/guomengkai/p/11357642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!