Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: modernize for 0.52.4

...

Code Block
languagejavascript
themeConfluence
a = [3, 4, 5];
c = a.tail(); // c = [4, 5]

Note

This note is for the operators which expect a function as their argument: all, any, collect, filter, map, none, and notall. The function provided is called once for each element of the target array, in order, and actually has three arguments passed to it: first, the array element, second, the current index in the array, and third, the entire target array. The last two are rarely if ever needed, but are available for those rare cases. Ordinarily, only the first argument, the array element, is needed.

For example, suppose you needed to know if any element in an array was less than its index in the array.

Code Block
a = [ 15, 7, 3, 1 ]
b = a.any(function(e,i){e < i}) // b == true because the element at index 3 (1) is less than 3