- 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 - Iterating Array
Underscore.JS has many easy to use methods which helps in iterating Arrays. This chapter discusses them in detail.
Underscore.JS provides various methods to iterate the Arrays as listed below −
Sr.No. | Method & Syntax |
---|---|
1 | first
_.first(array, [n]) |
2 | initial
_.initial(array, [n]) |
3 | last
_.last(array, [n]) |
4 | rest
_.rest(array, [index]) |
5 | indexOf
_.indexOf(array, value, [isSorted]) |
6 | lastIndexOf
_.lastIndexOf(array, value, [fromIndex]) |
7 | sortedIndex
_.sortedIndex(array, value, [iteratee], [context]) |
8 | findIndex
_.findIndex(array, predicate, [context]) |
9 | findLastIndex
_.findLastIndex(array, predicate, [context]) |
Advertisements