Lodash - prototype.commit 方法
語法
_.prototype.commit()
執行鏈序列並返回包裝後的結果。
輸出
(物件) − 返回新的 lodash 包裝例項。
示例
var _ = require('lodash');
var array = [1, 2];
var wrapped = _(array).push(3);
wrapped = wrapped.commit();
console.log(array);
將上述程式儲存在 tester.js 中。執行以下命令以執行該程式。
命令
\>node tester.js
輸出
[ 1, 2, 3 ]
lodash_seq.htm
廣告