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.?!
Building on the excellent answer by @Alexander Moiseyev.
You can avoid setting and mutating both variables a and winner by doing the following:
return objKeys.reduce((acc, val) =>
frequency[val] === highestVal
? [...acc, val]
: acc
,[])
note: for clarity I have explicitly declared the accumulator and value in this reduce method.