JavaScript数组forEach方法
JavaScript数组forEach方法
遍历数组一个特别好用的方法: 数组.forEach()
forEach( function( element,index,self ){ },this)
参数
意义
element(必填)
数组的每一项
index
每一项所对应的的索引
self
当前项所属的数组
this(基本不用)
this指向该参数
var arr = ['a', 'b', 'c'];
arr.forEach(function(item, index, ar
原创
2021-03-28 20:59:58 ·
280 阅读 ·
0 评论