JSFiddle - React, Tailwind, and code Playground
JavaScript
function compare(x, y) {
if (x === y) {//For reference types:returns true if x and y points to same object
return true;
}
if (x.length != y.length) {
return false;
}
for (key in x) {
if (x[key] !== y[key]) {//!== So that the the values are not converted while comparison
console.log(x[key]+" != "+y[key]);
return false;
}
}
return true;
}
combinaisonasasa = [
[1,1,1,1,0,0],
[1,1,1,1,1,0],
[1,1,1,1,0,1],
[1,1,0,1,1,0],
[1,1,0,1,0,1]
];
saisiecomb = [1,1,1,1,0,0];
inArray = false;
for(i=0; i< combinaisonasasa.length; i++){
if(compare(saisiecomb,combinaisonasasa[i])) inArray = true;
}
alert(inArray);