标签:map script display equal length lte 数组 replace val
let array = [‘a‘,‘b‘,‘c‘]; for (let i = 0;i < array.length;i++){ console.log(array1[i]); // a b c }
for(let index in array) { console.log(index,array[index]); };
forEach和map用法类似,都可以遍历到数组的每个元素,而且参数一致;
array.forEach(v=>{ console.log(v); }); array.forEach(function(v){ console.log(v); });
valueList.forEach(element => { console.log(element + " is exist in the list"); let label = this.filterLabel.replace(/\{0\}/g, element); let result = $(label).isDisplayed(); expect(result).to.equal(false); });
javascript 中forEach,for in循环的用法
标签:map script display equal length lte 数组 replace val
原文地址:https://www.cnblogs.com/cherry1130/p/12426471.html