Finds last index of a value.
npm install @extra-array/last-index-ofFinds last index of a value.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Alternatives: [indexOf], [lastIndexOf].
> Similar: [search], [indexOf], [isValue], [includes].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.lastIndexOf(x, v, [i]);
// x: an array
// v: search value
// i: start index (X-1)
`javascript
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 ^
``
- List-Extra.elemIndex: elm
- Array.prototype.indexOf: MDN web docs
- _.lastIndexOf: lodash
- Array.lastIndexOf: sugarjs
[indexOf]: https://github.com/nodef/extra-array/wiki/indexOf
[lastIndexOf]: https://github.com/nodef/extra-array/wiki/lastIndexOf
[search]: https://github.com/nodef/extra-array/wiki/search
[isValue]: https://github.com/nodef/extra-array/wiki/isValue
[includes]: https://github.com/nodef/extra-array/wiki/includes