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: