Skip to content

Latest commit

 

History

History

forEach

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

介绍

forEach(),给定一函数,遍历执行。此方法不改变原数组。

注:除了抛出异常,否则无法终止遍历。

MDN 参考

语法

arr.flatMap(callback(currentValue[, index[, array]])[, thisArg])

参数

callback
每个元素执行的函数。其参数有三:
currentValue
当前元素
index(可选)
当前索引
array(可选)
调用 forEach 的数组
thisArg(可选)
callback 所绑定的 this

返回值

undefined