Nice article!
If I could provide some suggestion here, in the second for loop, all those lines of if conditions and isEven() function call can be reduced to pairs += counts[item] / 2 | 0 to get the integer division value.
for (const item in counts)
pairs += counts[item] / 2 | 0;