Return an array consisting of the largest number from each provided sub-array.
<script>
console.log(largestArrayNum([[17, 23, 25, 12], [25, 7, 34, 48]])); //[25, 48]
console.log(largestArrayNum([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])); // [27, 5, 39, 1001]
console.log(largestArrayNum([[32, 35, 37, 39], [1000, 1001, 857, 1], [13, 35, 18, 26]])); // [39, 1001, 35]
function largestArrayNum(arr) {
return arr.map(Function.apply.bind(Math.max, null));
}
</script>
Most Helpful This Week
ES6 method of declaration multiple variables in one line
Image Rollover Using onMouseOver and onMouseOut
jQuery show input text inside div after on click event
jQuery check if an element is visible or hidden
Highlight and get the details of table row on click using JavaScript
JavaScript calculate Fahrenheit from Celsius