Skip to content

searchMismatchedValue

Subhajit Sahu edited this page May 3, 2023 · 1 revision

Find first index where two arrays differ.


function searchMismatchedValue(x, y, fc, fm)
// x:  an array
// y:  another array
// fc: compare function (a, b)
// fm: map function (v, i, x)

const xarray = require('extra-array');

var x = [1, 2, 3, 4, 5];
var y = [1, 2, 3, 3, 4, 5];
xarray.searchMismatchedValue(x, y);
// → 3

var x = [1, 2, 3, 4, 5];
var y = [1, 2, 3, 4, 5];
xarray.searchMismatchedValue(x, y);
// → -1


References

Clone this wiki locally