Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active December 20, 2015 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapsam/6073929 to your computer and use it in GitHub Desktop.
Save mapsam/6073929 to your computer and use it in GitHub Desktop.
Get min max of array
length = stadia.features.length;
var caps = [];
for (var mug=0; mug<length; mug++) {
var cap = stadia.features[mug].properties.capacity
caps.push(Number(cap));
}
var min = Math.min.apply(Math, caps);
var max = Math.max.apply(Math, caps);
@mapsam
Copy link
Author

mapsam commented Jul 24, 2013

Example is from world stadiums

@mapsam
Copy link
Author

mapsam commented Jul 24, 2013

Array is being generated from a csv file in d3. Uses javascript Math calculations and apply() to substitute values from the array to use with the Math function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment