chrislloyd (owner)

Revisions

gist: 137931 Download_button fork
public
Public Clone URL: git://gist.github.com/137931.git
max.js
1
2
3
4
5
6
7
8
9
10
11
function max() {
    if(arguments[0].length === 0) {return arguments[1] || NaN;}
    else {
        return max(arguments[0], Math.max(arguments[1] || 0, Math.max.apply(Math, arguments[0].pop())));
    }
};
 
var a = [[1,2,3],[4,5,6]];
 
console.log(a);
console.log(max(a));