Skip to content

Instantly share code, notes, and snippets.

@ESeufert
Created May 2, 2014 09:08
Show Gist options
  • Save ESeufert/bf50b4a6d41fd51a0228 to your computer and use it in GitHub Desktop.
Save ESeufert/bf50b4a6d41fd51a0228 to your computer and use it in GitHub Desktop.
function getMaxObjectValue(this_array, element) {
var values = [];
for (var i = 0; i < this_array.length; i++) {
values.push(Math.ceil(parseFloat(this_array[i][""+element])));
}
values.sort(function(a,b){return a-b});
return values[values.length-1];
}
function getMinObjectValue(this_array, element) {
var values = [];
for (var i = 0; i < this_array.length; i++) {
values.push(Math.floor(parseFloat(this_array[i][""+element])));
}
values.sort(function(a,b){return a-b});
return values[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment