- Underscore.JS Tutorial
- Underscore.JS - Home
- Underscore.JS - Overview
- Underscore.JS - Environment Setup
- Underscore.JS - Iterating Collection
- Underscore.JS - Processing Collection
- Underscore.JS - Iterating Array
- Underscore.JS - Processing Array
- Underscore.JS - Functions
- Underscore.JS - Mapping Objects
- Underscore.JS - Updating Objects
- Underscore.JS - Comparing Objects
- Underscore.JS - Utilities
- Underscore.JS - Chaining
- Underscore.JS Useful Resources
- Underscore.JS - Quick Guide
- Underscore.JS - Useful Resources
- Underscore.JS - Discussion
Underscore.JS - Processing Collections
Underscore.JS has many easy to use methods which helps in processing Collections. This chapter discusses them in detail.
Underscore.JS provides various methods to process the Collections as listed below −
Sr.No. | Method & Syntax |
---|---|
1 | contains
_.contains(list, value, [fromIndex]) |
2 | invoke
_.invoke(list, methodName, *arguments) |
3 | pluck
_.pluck(list, propertyName) |
4 | max
_.max(list, [iteratee], [context]) |
5 | min
_.min(list, [iteratee], [context]) |
6 | sortBy
_.sortBy(list, iteratee, [context]) |
7 | groupBy
_.groupBy(list, iteratee, [context]) |
8 | indexBy
_.indexBy(list, iteratee, [context]) |
9 | countBy
_.countBy(list, iteratee, [context]) |
10 | shuffle
_.shuffle(list) |
11 | sample
_.sample(list, [n]) |
12 | toArray
_.toArray(list) |
13 | size
_.size(list) |
14 | partition
_.partition(list, predicate) |
15 | compact
_.compact(list) |
Advertisements