Tell us what’s happening:
Hi !
I extracted a few steps to do the challenge “Return Largest Numbers in Arrays”.
The first step is to sort the arrays.
I am using a for loop to go through all the arrays but it seems that it only sorts the first one.
Can you help me identify the issue here?
Thanks a million!
Your code so far
function largestOfFour(arr) {
// You can do this!
var arrayLength = arr.length;
for (var i = 0; i < arrayLength ; i++ ){
arr[i].sort(function(a,b){return(a - b);});
return arr[i];
}
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);```
**Your browser information:**
Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 OPR/51.0.2830.34```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/return-largest-numbers-in-arrays