Return Largest Number Algorithm Alternate Solution?

Return Largest Number Algorithm Alternate Solution?
0.0 0

#1

Hello All,

I recently completed this challenge with a little help of google searching and the MDN site. The solution I arrived at seems like it is somewhere in-between the intermediate and advanced solution. I wanted to know if anyone else came to something similar or if either of the solutions of the hints page would be preferable to what I came up with for some reason.

function largestOfFour(arr) {

  var largest = [];
  for (i = 0; i < arr.length; i++){
    largest.push(Math.max(...arr[i]));
  }
  
  return largest;
}

Cheers


#2

When you post a full solution, please surround it with [spoiler] and [/spoiler] tags.