-
Notifications
You must be signed in to change notification settings - Fork 5
lastIndexOf
Subhajit Sahu edited this page May 3, 2023
·
15 revisions
Find last index of a value.
Alternatives: indexOf, lastIndexOf.
Similar: search, indexOf, isValue, includes.
function lastIndexOf(x, v, i)
// x: an array
// v: search value
// i: begin index [|x|-1]
const xarray = require('extra-array');
var x = [1, 2, 3, 2, 5];
xarray.lastIndexOf(x, 2);
// → 3 ^
var x = [1, 2, 3, 2, 5];
xarray.lastIndexOf(x, 2, 2);
// → 1 ^