Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active December 20, 2015 04:49
Show Gist options
  • Select an option

  • Save mapsam/6073929 to your computer and use it in GitHub Desktop.

Select an option

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

mapsam commented Jul 24, 2013

Copy link
Copy Markdown
Author

Example is from world stadiums

@mapsam

mapsam commented Jul 24, 2013

Copy link
Copy Markdown
Author

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