I have the following array:
const sales = [
  { name: 'a', count: 0 },
  { name: 'a', count: 0 },
  { name: 'b', count: 0 }
]
I want to count their occurrence:
const result = []
sales.forEach(sale => {
  if (result.includes(sale)) { // check if the item is in the new array
    sale.count += 1 // if it is, add one to count
  } else {
    result.push(sale) // if not, put the item in the array 
  }
})
But the if statement never returns true. Why is this and how to fix it?
 
    