
- Underscore.JS 教程
- Underscore.JS - 主頁
- Underscore.JS - 概述
- Underscore.JS - 環境設定
- Underscore.JS - 迭代集合
- Underscore.JS - 處理集合
- Underscore.JS - 迭代陣列
- Underscore.JS - 處理陣列
- Underscore.JS - 函式
- Underscore.JS - 對映物件
- Underscore.JS - 更新物件
- Underscore.JS - 比較物件
- Underscore.JS - 實用工具
- Underscore.JS - 鏈式呼叫
- Underscore.JS 有用資源
- Underscore.JS - 速查
- Underscore.JS - 有用資源
- Underscore.JS - 討論
Underscore.JS - 概述
Underscore.JS 是一個流行的基於 JavaScript 的庫,它提供了 100 多個函式來簡化 Web 開發。它提供 map、filter、invoke 等幫助函式以及函式繫結、JavaScript 模板化、深度相等性檢查、建立索引等功能。Underscore.JS 可直接在瀏覽器中以及與 Node.js 一起使用。
使用 JavaScript 處理物件可能頗具挑戰性,特別是當你要對其進行大量操作時。Underscore 帶有許多特性,可以簡化你處理物件時的工作。
Underscore.JS 是一個開源專案,你可以輕鬆地為這個庫貢獻程式碼並以外掛的形式新增特性,使其可在 GitHub 和 Node.js 中使用。
特性
讓我們詳細瞭解 Underscore 中所有可用的重要特性。
集合
Underscore.JS 為集合提供了各種函式,例如 each、map、reduce,這些函式用於對集合的每個項執行操作。它提供了 groupBy、countBy、max、min 等方法來處理集合並簡化許多工。
陣列
Underscore.JS 為陣列提供了諸如迭代和處理陣列等各種函式,例如 first、initial、lastIndexOf、intersection、difference 等。
函式
Underscore.JS 提供了諸如 bind、delay、before、after 等函式。
物件
Underscore.JS 為操作物件、對映物件以及比較物件提供了函式。例如,keys、values、extends、extendsOwn、isEqual、isEmpty 等。
實用工具
Underscore.JS 提供了 noConflict、random、iteratee、escape 等各種實用工具方法。
鏈式呼叫
Underscore.JS 也提供 chain、value 等鏈式呼叫方法。
在後續章節中,我們將介紹 Underscore.JS 的重要功能。