I am trying to filter objects who key’s correspond to values in an array of arrays. So 3 sets of objects each filtered by their placement in an array. (Objects are listed in an array.) I suspect this is a two-part question. Why doesn’t the Array.prototype.includes method return true, when the case is true?
boardObj = [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
const winCol = (boardObj) => {
const indexes = [[0,1,2], [3,4,5], [6,7,8]];
let result = indexes.filter((ele) => {
for (const [k, v] of Object.entries(boardObj)) {
console.log(ele.includes(0))
console.log(ele.includes(k))
if (ele.includes(k)) {
return v
}
}
})
console.log(result)
}