mapRange()
returns a new array of the items according to the specified parameters
mapRange(from: number, to: number, callback: (item: object, index?: number, array?: object[]) => any): object[];
Parameters:
from: number
- the initial position of an item in the rangeto: number
- the final position of an item in the rangecallback: function
- a function that will be called for each item from the specified range. The function is called with the following parameters:item
- the object of an itemindex
- the index of an itemarray
- an array of items the method was called upon
Returns:
A new array of matching item objects.
Example
const result = component.data.mapRange(0, 20, function(item, index, array) {
console.log(item.id, index);
});