🖼️ Lyin's Room

Search

Search IconIcon to open search

遍历数组forEach方法

Last updated Unknown

Related to:ES6

1
2
3
4
5
    const arr = ['red', 'blue', 'pink']
    arr.forEach(function(item, index) {
        console.log(item)
        console.log(index)
    })

结果: