-
Notifications
You must be signed in to change notification settings - Fork 5
findRight
Subhajit Sahu edited this page Mar 17, 2020
·
28 revisions
Finds index of rightmost value passing the test.
array.findRight(x, fn, [ths]);
// x: an array
// fn: test function (v, i, x)
// ths: this argument
// --> index of value, -1 if not found
const array = require('extra-array');
array.findIndices([1, 2, 3, 4], v => v % 2 == 0);
// [1, 3]
array.findIndices([1, 2, 3, 4, 5], v => v % 2 == 1);
// [0, 2, 4]