Why doesn\'t a.push(b) work in my Array.reduce()? a=a.push(b) where b is a string, turns a to an integer.?!
a.push(b)
Array.reduce()? a=a.push(b)
b
a
Since push() returns the new length of the array, you're assigning the length to a. Instead of a conditional operator, use an if statement.
push()
if
var winner = objKeys.reduce((a, b) => { if (frequency[b] === highestVal) { a.push(b); } return a; }, []);