So, I started playing with reduce() and I realised I can pass an Object as the first element of the method and I saw a couple of examples and this is one of them.

```
const arr = ['y', 'n', 'y', 'y', 'n'];

let test = arr2.reduce((sum, val) => {
    sum[val] = (sum[val] || 0) + 1;
    console.log('sum of val', sum[val], 'value', val)
    return sum;
}, {})

```

I added that console log so I can see what is going on, but I cant figure it out. HOW DOES THE METHOD KNOW? How does it add that val (which is n or y) in the object and followed by it add the sum of how many of identical elements exists in the array. How does that sum become for example {y: 20} - assuming there are 20 y's in an array.

Im confused by it, at first it seemed simple but I guess its not.