Lodash

是一个一致性、模块化、高性能的 JavaScript 实用工具库。

“集合” 方法(“Collection” Methods)

_.forEachRight(collection, [iteratee=_.identity])

这个方法类似 _.forEach,不同之处在于,_.forEachRight 是从右到左遍历集合中每一个元素的。

添加版本

2.0.0

别名

_.eachRight

参数

  1. collection (Array|Object): 一个用来迭代的集合。
  2. [iteratee=_.identity] (Function): 每次迭代调用的函数。

返回

(*): 返回集合 collection

例子

_.forEachRight([1, 2], function(value) {
  console.log(value);
});
// => Logs `2` then `1`.

数组 Array

集合 Collection

日期 Date

函数 Function

Lang

数学 Math

数字 Number

对象 Object

Seq

字符串 String

实用函数 Util

Properties

Methods