微信小程序 for循环 array数组操作详解

一、for循环的使用
①for(let i = 0 ; i < length ; ++i){ }
示例:

 for(let i=0;i<length;++i){
     console.log(temp[i])
 }

②for(var x in temp){ }
示例:

for (var x in temp) {//x = index
    that.data.imgs.push({ path: temp[tm],label:'添加标签'});
}

二、array数组属性及方法 参照链接:http://www.w3school.com.cn/jsref/jsref_obj_array.asp
这里写图片描述
数组修改;
this.data.imgs[0].path=”//a/b”

猜你喜欢

转载自blog.csdn.net/yingtian648/article/details/80015298