function largestOfFour(arr) {
// You can do this!
var largestArr = [];
for(var i=0; i<arr.length; i++){
var temp = -1000000;
for(var j=0; j<arr[i].length; j++){
if(temp < arr[i][j]){
temp = arr[i][j];
}
}
largestArr.push(temp);
}
return largestArr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
No comments:
Post a Comment