Skip to content

isEqual

Subhajit Sahu edited this page May 3, 2023 · 23 revisions

Examine if two arrays are equal.

Similar: compare, isEqual.


function isEqual(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];
xarray.isEqual(x, [1, 2]);
// → true

xarray.isEqual(x, [11, 12]);
// → false

xarray.isEqual(x, [11, 12], (a, b) => (a % 10) - (b % 10));
// → true

xarray.isEqual(x, [11, 12], null, v => v % 10);
// → true


References

Clone this wiki locally