Finds index of smallest value.
Alternatives: min, minIndex.
Similar: min, max, range.
This is part of package extra-array.
array.minIndex(x, [fc], [fm]);
// x: an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');
var x = [1, 2, -3, -4];
array.minIndex(x);
// 3 ^
array.minIndex(x, (a, b) => Math.abs(a) - Math.abs(b));
// 0 ^
array.minIndex(x, null, v => Math.abs(v));
// 0 ^