function largestOfFour(arr) { var array = []; for (var i in arr) { array.push(arr[i].sort(function (a, b) { return b- a; })[0]); } return array; } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])
应该返回一个数组largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])
应该返回 [27,5,39,1001]
.largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])
应该返回 [9, 35, 97, 1000000]
.