Underscore.JS - 實用工具



Underscore.JS 有許多易於使用的實用工具方法。本章將詳細介紹它們。

Underscore.JS 提供以下各種實用程式方法 -

序號 方法和語法
1 恆等性

_.identity(value)

2 常量

_.constant(value)

3

_.noop()

4

_.times(n, iteratee, [context])

5 隨機

_.random(min, max)

6 混合

_.mixin(object)

7 迭代

_.iteratee(value, [context])

8 唯一識別符號

_.uniqueId([prefix])

9 轉義

_.escape(string)

10 取消轉義

_.unescape(string)

11 結果

_.result(object, property, [defaultValue])

12 現在

_.now()

13 模板

_.template(templateString, [settings])

廣告
© . All rights reserved.