Created
June 7, 2016 06:00
-
-
Save vg22/f3d86d53e2ec76f7912af4bf0e282951 to your computer and use it in GitHub Desktop.
This file contains 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
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