Underscore.JS - Matriz iterativa
Underscore.JS tiene muchos métodos fáciles de usar que ayudan a iterar Arrays. Este capítulo los analiza en detalle.
Underscore.JS proporciona varios métodos para iterar las matrices que se enumeran a continuación:
| No Señor. | Método y sintaxis |
|---|---|
| 1 | primero _.first (matriz, [n]) |
| 2 | inicial _.initial (matriz, [n]) |
| 3 | último _.last (matriz, [n]) |
| 4 | descanso _.rest (matriz, [índice]) |
| 5 | índice de _.indexOf (matriz, valor, [isSorted]) |
| 6 | lastIndexOf _.lastIndexOf (matriz, valor, [fromIndex]) |
| 7 | sortedIndex _.sortedIndex (matriz, valor, [iteratee], [contexto]) |
| 8 | findIndex _.findIndex (matriz, predicado, [contexto]) |
| 9 | findLastIndex _.findLastIndex (matriz, predicado, [contexto]) |