Tell us what’s happening:
Can’t pass the challenge even though returned value is correct. I would really appreciate if someone could point out my mistake. Thanks!
Your code so far
function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
for (var i=0; i<arr.length; i++) {
var a = arr[i].avgAlt + earthRadius;
let periood = Math.round(Math.sqrt((Math.pow(a, 3) / GM)) * 2 * Math.PI);
Object.defineProperty(arr[i], "orbitalPeriod", {
value: periood
});
delete arr[i].avgAlt;
}
console.log(arr);
return arr;
}
orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])
orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}])
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris