Map the Debris Help

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:

I looked through the forum and saw the method to avoid creating a temporary obj by deleting the arr.avgAlt. I modified my original code to incorporate delete avgAlt and that worked. I still don’t understand why my answer didn’t register as accurate. Perhaps it was the creation of new object instances ?

The problem is with this part:

let orbits = [{
  name: "",
  orbitalPeriod: ""
}];

If you remove the wrapping array your code will work.

Btw, you can avoid Object.create if you just use:

let newObj = { name, orbitalPeriod: answer };