Last active
December 20, 2015 04:49
-
-
Save mapsam/6073929 to your computer and use it in GitHub Desktop.
Get min max of array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
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
Example is from world stadiums