My code works but i don't get passed here

Tell us what’s happening:
Describe your issue in detail here.
Why don’t i get passed this one?

  **Your code so far**

function largestOfFour(arr) {
var newArr = []
let result 

arr.forEach(subArr=> {
  newArr.push(Math.max.apply(null, subArr))
  if (subArr.indexOf(Math.max.apply(null, newArr)) >= 0) 
  {
    result = subArr
  }
})  
 return result
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Challenge: Return Largest Numbers in Arrays

Link to the challenge:

Hello,

Make sure that return value is the data you actually gathered

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])

//[1000,1001,857,1]

Instruction:

Return an array consisting of the largest number from each provided sub-array

Снимок экрана 2021-06-12 в 20.03.30

as you can see here i got the array

i completed the task. it was my wrong. thanks for your reply

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.