I'm stuck on why my Javascript findMaxObjectValue function will not work. Here's what I've come up with:
function findMaxObjectValue(obj) {
return Object.keys(obj).reduce(function(a, b) {
return (obj.a > obj.b) ? a : b;
}, obj[a]);
}
When I run this:
findMaxObjectValue([{Alex: 1}, {Katie: 2}, {Nora: 3}, {Dana: 4}])
It returns '3', when I am hoping for '4'... All help appreciated!