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
Very basic method. might be slow to process
var v = {a: 1, b: 2, undefined: 1}; function geth(o){ var vals = []; for(var i in o){ vals.push(o[i]); } var max = Math.max.apply(null, vals); for(var i in o){ if(o[i] == max){ return i; } } } console.log(geth(v));