Module: util/array-reverse-iterator

Utility module for reverse array iteration

Source:

Methods

(static) getReverseIterator(arr) → {Iterable}

Parameters:
Name Type Description
arr Array.<*>

This function returns an iterator that performs reverse iteration over the given array. It can be used with for...of loops, for example.

Example usage:

const array = [1,2,3,4,5];
for (const item of getReverseIterator(array)) {
    console.log(item);
}
// Output: 5 4 3 2 1 (one number per line)
Source:
Returns:

Type: Iterable