Skip to content

lastIndexOf

Subhajit Sahu edited this page May 19, 2020 · 15 revisions

Finds last index of a value. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]

Alternatives: [indexOf], [lastIndexOf].

iterable.lastIndexOf(x, v, [i]);
// x: an iterable
// v: search value
// i: start index
const array = require('extra-array');

var x = [1, 2, 3, 2, 5];
array.lastIndexOf(x, 2);
// 3              ^

var x = [1, 2, 3, 2, 5];
array.lastIndexOf(x, 2, 2);
// 1        ^

references

Clone this wiki locally