Skip to content

isEqual

Subhajit Sahu edited this page Mar 15, 2020 · 23 revisions

Compares two arrays.

array.compare(x, y, [fn]);
// x:  an array
// y:  another array
// fn: compare function (a, b)
// --> x<y: -1, x=y: 0, x>y: 1
const array = require('extra-array');

array.compare([1], [1, 2]);
// -1

array.compare([1, 2], [1, 2]);
// 0

array.compare([1, 2], [1, 1]);
// 1

references

Clone this wiki locally