js to find out more than the maximum value in the array

        The large array contains four small arrays, find the maximum value in each small array, and then concatenate them to form a new array.

<script>
    function fnArr(arr){
        var newArr = [];
        arr.forEach((item,index)=>{
            newArr.push(Math.max(...item))
        })
        return newArr;
    }
    console.log(fnArr([
    [4,5,1,3],
    [13,27,18,26],
    [32,35,37,39],
    [1000,1001,857,1]
    ]));//[5,27,39,1001]
</script>

Guess you like

Origin blog.csdn.net/m0_73460278/article/details/126987188