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
Example to take user input and display on screen using JavaScript
JavaScript simple alert on Click
Edit the text of label on click using jQuery
jQuery simple form validations between start date and end date
How to show hide option list items using jQuery?
Highlight and get the details of table row on click using JavaScript