我正在try 让if语句检测这两个数组是否有相等的部分.
const winningCombos = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
const mySpots = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
function test() {
winningCombos[0].splice(0, 3, 'testsss')
//position 0 remove 1
if (winningCombos[0] || winningCombos[1] || winningCombos[2] === mySpots[0] || mySpots[1] || mySpots[2]) {
document.getElementById("test").innerHTML = 'sucess'
} else {
document.getElementById("test").innerHTML = 'fail'
}
}
但我也想让if语句变成
if ((winningCombos[0] OR winningCombos[1] OR winningCombos[2]) is equal to(mySpots[0] || mySpots[1] || mySpots[2]) {
console.log('success');
};
有什么你们都能找到的解决方案吗?