Last active
February 2, 2025 18:37
-
-
Save saralilyb/f704f09b9c66628550d9 to your computer and use it in GitHub Desktop.
The following are done up to dig into nested arrays and find the max or min values in them. In CoffeeScript. From http://stackoverflow.com/questions/10564441/how-to-find-the-max-min-of-a-nested-array-in-javascript.
This file contains hidden or 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
arrmax = (arrs) -> | |
toplevel = [] | |
i = 0 | |
l = arrs.length | |
while i < l | |
toplevel.push Math.max.apply(window, arrs[i]) | |
i++ | |
Math.max.apply window, toplevel | |
arrmin = (arrs) -> | |
toplevel = [] | |
i = 0 | |
l = arrs.length | |
while i < l | |
toplevel.push Math.min.apply(window, arrs[i]) | |
i++ | |
Math.min.apply window, toplevel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment