Map the Debris , freeCodeCamp not accepting code

Tell us what’s happening:

The Code is Working just fine and giving the right outputs but freeCodeCamp is not accepting it.

  **Your code so far**
function orbitalPeriod(arr) {
let newArr = [...arr];
const GM = 398600.4418;
const earthRadius = 6367.4447;
let orbitalAxis = 0;
let timePeriod = 0;
for(let i = 0; i<arr.length; i++){
  //Orbital Axis
orbitalAxis = Math.pow((earthRadius + arr[i]["avgAlt"]),3);

// Orbital time Period
timePeriod = 2*(Math.PI)*Math.sqrt((orbitalAxis)/GM);
timePeriod = Math.round(timePeriod);
newArr[i]["avgAlt"] = timePeriod;
    }
console.log(newArr);
return newArr; 
}

orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);
orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37

Challenge: Map the Debris

Link to the challenge:

The output from your console.log before the return doesn’t seem to be what the tests want.

2 Likes

this is what you are returning

[ { name: 'sputnik', avgAlt: 86400 } ]

this is what it is looking for

[{name: "sputnik", orbitalPeriod: 86400}]
1 Like

Thanks for pointing that out .