Tell us what’s happening:
When I checked the output, it had the correct output answer but its not registering in Freecodecamp. What have I done wrong?
**Your code so far**
function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
let args = [...arr]
let orbits = [{
name: "",
orbitalPeriod: ""
}];
let newArray = []
for (let i = 0 ; i <= arr.length; i++){
if (args.length){
let isolate = args.pop()
let answer = Math.round(Math.sqrt((4 * Math.pow(Math.PI, 2) * Math.pow(earthRadius + isolate.avgAlt , 3))/GM))
let newObj = Object.create(orbits)
newObj.name = isolate.name
newObj.orbitalPeriod = answer;
newArray.unshift(newObj)
}
}
return newArray
}
console.log(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/88.0.4324.182 Safari/537.36
.
Challenge: Map the Debris
Link to the challenge: