Tell us what’s happening:
I used the read-search-ask formula, except this time I didn’t have to ask anybody. While it’s a great sign of improvement, I’m hoping that my notes demonstrate a good understanding my solution. There have been many times where I came up with solutions and did not understand an ounce of what I typed.
Your code so far
function largestOfFour(arr) {
// You can do this!
var largestArr = arr.map(function(num){//.map was used to iterate through all subarrays
return Math.max.apply(null,num);//Math.max returns the largest value in an array, .apply helps execute the values selected by Math.max. When .apply method is used, I pass null as an argument so that the num arg can be returned.
});
return largestArr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
.
Link to the challenge: