I'm able to successfuly find out the largest values in the object, however. There is a problem, and that is inability to display the associated key with that value.
var obj = {
t1: 1,
t2: 33,
t3: 10,
t4: 9,
t5: 45,
t6: 101
//...
}
// create an array
var arr = [];
// loop through the object and add values to the array
for (var p in obj) {
arr.push(obj[p]);
}
// sort the array, largest numbers to lowest
arr.sort(function(a,b){return b - a});
// grab the first 10 numbers
var firstThree = arr.slice(0, 3);
console.log(firstThree);
It can display the top values, however i'm having a hard time to display keys with that.
The result should be like
var result = {
t6: 101,
t5: 45,
t2: 33
}