Iterator.prototype.forEach()
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Iterator 实例的 forEach() 方法与 Array.prototype.forEach() 类似:它为迭代器生成的每个元素执行一次提供的函数。
¥The forEach() method of Iterator instances is similar to Array.prototype.forEach(): it executes a provided function once for each element produced by the iterator.
语法
参数
¥Parameters
callbackFn-
对迭代器生成的每个元素执行的函数。它的返回值被丢弃。使用以下参数调用该函数:
返回值
描述
示例
使用 forEach()
规范
| Specification |
|---|
| Iterator Helpers # sec-iteratorprototype.foreach |
浏览器兼容性
BCD tables only load in the browser