How come this solution is not accepted?

Tell us what’s happening:
The following code is based on a solution for the Longest Word question prior to this one. Any thoughts on why this is not acceptable? I understand it’s only one of the many ways to solve this though.

Your code so far


function largestOfFour(arr) {
for(let i=0; i<arr.length; i++) {
  let arrSet = arr[i];
  console.log("arrSet" + i, arrSet)
  let compare = (set) => {
    console.log("starting set: ", set);
    // if set only has one number left
    // splice the set
    if(set.length === 1) {
      console.log("new set (", i, "): ", set);
      return set;
    }
    // if first num is greater than
    // recursively compare the same set
    else if(set[0] >= set[1]) {
      console.log(set[0], " is greater");
      set.splice(1, 1)
      return compare(set);
    }
    // if first num is less than
    else if(set[0] <= set[1]) {
      console.log(set[1], " is greater")
      return compare(set.slice(1, set.length));
    }
  }
  arr.splice(i, 1, compare(arrSet));
}
console.log("final arr", arr);
return arr;
}

// returns [ [ 5 ], [ 27 ], [ 39 ], [ 1001 ] ]
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_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36.

Challenge: Return Largest Numbers in Arrays

Link to the challenge:

Your code does not return the correct values. You are supposed to be returning an array of numbers. Instead, you are returning an array of arrays which contain one number each. That is big difference.

For example, you return the following:

[ [ 5 ], [ 27 ], [ 39 ], [ 1001 ] ]

instead of:

[ 5, 27, 39, 1001 ]