Map the Debris Challenge - Correct Solution, Not Passing

Hey all,

Can you tell me why I am not passing the challenge? My code seems to return the correct answer but the challenge is not liking it.

function orbitalPeriod(arr) {
  const GM = 398600.4418,
        EARTH_RADIUS = 6367.4447,
        PI = Math.PI;
  let t = [];

  t.push( arr.map( ({name, avgAlt}) => {
    return {
      name: name,
      orbitalPeriod: Math.round( (2*PI) * Math.sqrt( Math.pow(EARTH_RADIUS + avgAlt, 3) / GM ) )
    };
  }));

  return t;
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
//returns [{name: "sputnik", orbitalPeriod: 86400}]
orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])
//returns [{name: "iss", orbitalPeriod: 5557}, {name: "hubble", orbitalPeriod: 5734}, {name: "moon", orbitalPeriod: 2377399}]

Thank you!

Link to the challenge

I got it!

The original code above was returning an array within an array that contained the correct solutions. I removed the t variable and simply returned the map() value directly. Here is the new code:

  const GM = 398600.4418,
        EARTH_RADIUS = 6367.4447,
        PI = Math.PI;
        
  return arr.map( ({name, avgAlt}) => {
    return {
      name: name,
      orbitalPeriod: Math.round( (2*PI) * Math.sqrt( Math.pow(EARTH_RADIUS + avgAlt, 3) / GM ) )
    };
  });
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);