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
JavaScript calculate Fahrenheit from Celsius
How to get selected text from a select box using jQuery?
Edit the text of label on click using jQuery
jQuery check if an element is visible or hidden
Generate random password for form field on click using JavaScript
JavaScript HTML5 Validation for name and email field