Skip to content

indexOf

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

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

Alternatives: [indexOf], [lastIndexOf].

iterable.indexOf(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.indexOf(x, 2);
// 1        ^

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

references

Clone this wiki locally