in Javascript, how can I express that if array1[i] and array2[j] also equal to either "0", "O" or "Q", then array1[i] is equal to array2[j]? I have tried multiple ways but it didn't work. Thanks.
if ((array1[i] == "0" || "O" || "Q") && (array2[j] == "0" || "O" || "Q")){
array1[i] == array2[j];
}
or
if ((array1[i] && array2[j]) == "0" || "O" || "Q"){
array1[i] == array2[j];
}
You can use another array to check whether it includes value of array[i]
const oArr = ["0", "O", "Q"]
if (oArr.includes(array1[i]) && oArr.includes(array2[j])) {
console.log("They both have 0, O or Q")
}