Tak jak w temacie czy taki sposób jest odpowiedni ?
winStreaks() {
const winCombos = [
["green", "green", "green"],
["red", "red", "red"],
["blue", "blue", "blue"]
];
if (JSON.stringify(this.divColor) === JSON.stringify(winCombos[0])) {
console.log("jackpot");
}
}
Czy może w taki sposób ?
for (let i = 0; i < this.divColor.length; i++) {
if (this.divColor == winCombos[i]) {
console.log("jackpott");
}
}
if (this.divColor == winCombos[0]) {
console.log("jackpott");
}
I pytanie czy może to nie działać przez observer , który się generuje w tablicy ? (to jest this.divColor)