Last updated 5 years ago
Was this helpful?
语法:
_.forOwnRight(object, [iteratee=_.identity])
源代码链接:
npm包链接:
描述:
这个方法类似。 除了它是反方向开始遍历object的。
object
开始版本:2.0.0
参数:
object (Object): 要遍历的对象。
object (Object)
[iteratee=_.identity] (Function): 每次迭代时调用的函数。
[iteratee=_.identity] (Function)
返回值:
(Object): 返回 object。
(Object)
例子:
function Foo() { this.a = 1; this.b = 2; } Foo.prototype.c = 3; _.forOwnRight(new Foo, function(value, key) { console.log(key); }); // => 输出 'b' 然后 'a', `_.forOwn` 会输出 'a' 然后 'b'
_.forOwn