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
How to scroll page to particular Div on click using jQuery?
JavaScript sort multi dimensional array on specific columns
jQuery example of scroll to top
Edit the text of label on click using jQuery
How to declare multiple variables in one statement in Javascript?
How to check if an element or HTML tag exists using JavaScript?