Skip to content

Instantly share code, notes, and snippets.

@vg22
Created June 7, 2016 06:00
Show Gist options
  • Save vg22/f3d86d53e2ec76f7912af4bf0e282951 to your computer and use it in GitHub Desktop.
Save vg22/f3d86d53e2ec76f7912af4bf0e282951 to your computer and use it in GitHub Desktop.
function largestOfFour(arr) {
// You can do this!
var max=0,i=0,j=0;
var newArray=[];
for (i=0;i<arr.length;i++){
for(j=0;j<=arr.length;j++)
if(arr[i][j]>max){
max=arr[i][j];
}
newArray.push(max);
}
console.log(newArray);
return newArray;
}
largestOfFour([[13, 27, 18, 26],[13, 27, 18, 26],[4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment