@extra-array/index-of.min

Finds first index of a value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraArrayIndexOfMin from 'https://cdn.skypack.dev/@extra-array/index-of.min';
</script>

README

Finds first 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.

This is browserified, minified version of @extra-array/index-of.
It is exported as global variable array_indexOf.
CDN: unpkg, jsDelivr.


array.indexOf(x, v, [i]);
// x: an array
// v: search value
// i: start index (0)
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