const arr = ['a', 'b', 'c']; for (const elem of arr) { console.log(elem); }
forEach
forEach() 方法用于调用数组的每个元素,并将元素传递给回调函数。
注意: forEach() 对于空数组是不会执行回调函数的。
allInput.forEach(element => { console.info(element) });
const arr = ['a', 'b', 'c']; for (const elem of arr) { console.log(elem); }
forEach() 方法用于调用数组的每个元素,并将元素传递给回调函数。
注意: forEach() 对于空数组是不会执行回调函数的。
allInput.forEach(element => { console.info(element) });
文章数
437
浏览数
99464
今日发布
0