prototype.commit
_.prototype.commit()
执行链序列并返回封装的结果。
¥Executes the chain sequence and returns the wrapped result.
新增于
¥Since
3.2.0
返回
¥Returns
(对象):返回新的 lodash
封装器实例。
¥(Object): Returns the new lodash
wrapper instance.
示例
¥Example
var array = [1, 2];
var wrapped = _(array).push(3);
console.log(array);
// => [1, 2]
wrapped = wrapped.commit();
console.log(array);
// => [1, 2, 3]
wrapped.last();
// => 3
console.log(array);
// => [1, 2, 3]