function getColumns(object){
//columns:
const columns = [];
const keys = Object.keys(object[Object.keys(object)[0]]);
keys.forEach(key => columns.push([]));
/* keys.shift(); //because you don't want the "date" */
let i = 0; // to move between the arrays of "columns"
for(id in object){
keys.forEach(key => {
console.log(i, key, object[id][key]);
columns[i].push(object[id][key]);
i++;
})
console.log("-----------");
i = 0;
}
return columns;
}
function MathMaxes(array){
//is a private function for you <3
const result = array.map(column=> Math.max(...column));
return result;
}
//the testing object
const data = {
1:{
date: "Mon Oct 31 2016 19:00:00 GMT-0500 (Central Daylight Time)",
Catan: 23432,
Dominion: 2233,
Codenames: 111,
"Terraforming Mars": 2344
},
2:{
date: "Mon Oct 31 2016 19:00:00 GMT-0500 (Central Daylight Time)",
Catan: 1123,
Dominion: 353,
Codenames: 54645,
"Terraforming Mars": 2333
},
3:{
date: "Mon Oct 31 2016 19:00:00 GMT-0500 (Central Daylight Time)",
Catan: 34673,
Dominion: 34532,
Codenames: 6457,
"Terraforming Mars": 1231
}
}
const columns = getColumns(data);
columns.shift(); //because you don't want the dates
const theMaxes = MathMaxes(columns);
console.log(theMaxes);