to different two arrays with true or false output. a compare two arrays with function this my code :
var cekDiff = function (arr1, arr2) {
var maxLength = 0,
cekTrue = 0;
if (arr1.length > arr2.length) maxLength = arr1.length;
else maxLength = arr2.length;
for (var i = 0; i < maxLength; i++) {
if (arr1[i] == arr2[i]) {
cekTrue++;
}
}
if (cekTrue >= maxLength) return true;
else return false;
}
if (cekDiff([0, 1, 2, 4, 3], [0, 1, 2, 3, 4])) {
console.log("match");
} else {
console.log("different");
}