-
Notifications
You must be signed in to change notification settings - Fork 5
isEqual
Subhajit Sahu edited this page Nov 20, 2022
·
23 revisions
Check if two arrays are equal.
function isEqual(x, y, fc, fm)
// x: an array
// y: another array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');
var x = [1, 2];
array.isEqual(x, [1, 2]);
// → true
array.isEqual(x, [11, 12]);
// → false
array.isEqual(x, [11, 12], (a, b) => (a % 10) - (b % 10));
// → true
array.isEqual(x, [11, 12], null, v => v % 10);
// → true