I have a object like that one:
Object {a: 1, b: 2, undefined: 1}
How can I quickly pull the largest value identifier (here: b
b
Supposing you've an Object like this:
Object
var obj = {a: 1, b: 2, undefined: 1}
You can do this
var max = Math.max.apply(null,Object.keys(obj).map(function(x){ return obj[x] })); console.log(Object.keys(obj).filter(function(x){ return obj[x] == max; })[0]);