扫码一下
查看教程更方便
underscore.js 有许多易于使用的方法,有助于处理函数。 本章将详细讨论它们。
underscore.js 提供了各种处理函数的方法,如下所示
| 序号 | 方法 | 语法 |
|---|---|---|
| 1 | bind | _.bind(function, object, *arguments) |
| 2 | partial | _.partial(function, *arguments) |
| 3 | memoize | _.memoize(function, [hashfunction]) |
| 4 | delay | _.delay(function, wait, *arguments) |
| 5 | once | _.once(function) |
| 6 | before | _.before(count, function) |
| 7 | _.wrap(function, wrapper) | |
| 8 | negate | _.negate(predicate) |
| 9 | compose | _.compose(*functions) |