主题
forEachRight
js
_.forEachRight(collection, [iteratee=_.identity])
此方法与 _.forEach
类似,不同之处在于它从右到左迭代 collection
的元素。
¥This method is like _.forEach
except that it iterates over elements of collection
from right to left.
新增于
¥Since
2.0.0
别名
¥Aliases
_.eachRight
参数
¥Arguments
collection
(数组|对象):要迭代的集合。¥
collection
(Array|Object): The collection to iterate over.[iteratee=_.identity]
(函数):每次迭代调用的函数。¥
[iteratee=_.identity]
(Function): The function invoked per iteration.
返回
¥Returns
(*):返回 collection
。
¥()*: Returns collection
.
示例
¥Example
js
_.forEachRight([1, 2], function(value) {
console.log(value);
});
// => Logs `2` then `1`.