摘要: 数组遍历的方法 forEach 类似与for循环 不会改变原数组 将数组中的2全部加1 const arr = [1,2,3,2] var newArr = [] arr.forEach(v=>{ if(v 2){ v=v+1 } newArr.push(v) }) console.log(newA 阅读全文
posted @ 2022-09-25 20:24 张尊娟 阅读(33) 评论(0) 推荐(0) 编辑