System would not accept my basic solution

System would not accept my basic solution
0.0 0

#1

Tell us what’s happening:

This basic solution worked but the system would not accept it. :slight_smile:

I checked it will all the three sets of arrays and all gave the expected “should return” answers. But I could not get the system to accept the answer and get the green go ahead!

See below :
Your code so far

function largestOfFour(arr) {
  // You can do this!
  
  var test = arr[0].sort(function(a,b) {return b-a;});  
  
  var largest = test[0]; 
 
  results.push(largest); 
  
  
  var test1 = arr[1].sort(function(a,b) {return b-a;});  
  
  var largest1 = test1[0]; 
 
  results.push(largest1); 
  
  
  var test2 = arr[2].sort(function(a,b) {return b-a;});  
  
  var largest2 = test2[0]; 
 
  results.push(largest2); 
  
  
  var test3 = arr[3].sort(function(a,b) {return b-a;});  
  
  var largest3 = test3[0]; 
 
  results.push(largest3); 
  
  
  return results ; 
  
  }
  
  
  


largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]); 

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36.

Link to the challenge:


#2

What do the failing tests say?

It looks like you never declared results so you should be getting an error.