Map the Debris not passing

Map the Debris not passing
0.0 0

#1

Tell us what’s happening:

Your code so far


function orbitalPeriod(arr) {
  // console.log(arr);
  var GM = 398600.4418;
  var earthRadius = 6367.4447;

  arr.forEach(function(arr) {
    Object.defineProperties(arr, {
      orbitalPeriod: {
        value: Math.round(2 * Math.PI * Math.sqrt(Math.pow(earthRadius + arr.avgAlt, 3) / GM))
      }
    })
    delete arr.avgAlt;
  })


  return arr;
}


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

It returns the array as expected but the test still not passing it.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris


#2

You have to return a new array. Not change the existing one. .map would therefore be better than .forEach