-
Notifications
You must be signed in to change notification settings - Fork 1
lastIndexOf
Subhajit Sahu edited this page May 13, 2020
·
15 revisions
Searches a value from right. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]
Alternatives: [left], [right], [all].
iterable.searchRight(x, v, [fn]);
// x: an iterable
// v: search value
// fn: compare function (a, b)
// --> index of value, -1 if not found
const iterable = require('extra-iterable');
var x = [1, 2, 3, 2, 5];
iterable.lastIndexOf(x, 2);
// 3 ^
var x = [1, 2, 3, 2, 5];
iterable.lastIndexOf(x, 2, 2);
// 1 ^