Largest numbers in arrays
function largestOfFour(arr) {
return arr.map(function(subArr) {
return Math.max.apply(null, subArr);
});
}
// Moje
function largestOfFour(arr) {
for (var i = 0; i < arr.length; i++) {
arr[i].sort(function(a, b){return b-a});
}
var arr2 = [];
for (var j = 0; j < arr.length; j++) {
arr2.push(arr[j][0]);
}
return arr2;
}