Creating an array consisting of the largest values of each sub-array does not work as expected

前端 未结 4 1571
执念已碎
执念已碎 2020-12-01 18:49

Find the largest number in each of the sub-array and then make an array of those largest numbers.[[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1

4条回答
  •  [愿得一人]
    2020-12-01 19:27

    I have been through the code and ended with other solution. The first for loop iterates through the big array and the second one through the components of the subarray.

    function largestOfFour(arr) {
      var main = [];
      for(k=0;k

提交回复
热议问题