Tell us what’s happening:
I can’t understand why it’s not passing the tests, formulas seem to be ok, what am I missing?
**Your code so far**
function orbitalPeriod(arr) {
const GM = 398600.4418;
const earthRadius = 6367.4447;
return arr.map(
item => ({name: item['name'],
avgAlt: Number(Math.round(
2 * Math.PI * Math.sqrt(
Math.pow(earthRadius + item['avgAlt'], 3) / GM
)
))}
)
);
}
console.log(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]));
console.log(orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]))
/*FCC console output
[ { name: 'sputnik', avgAlt: 86400 } ]
[ { name: 'iss', avgAlt: 5557 },
{ name: 'hubble', avgAlt: 5734 },
{ name: 'moon', avgAlt: 2377399 } ]
*/
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Map the Debris
Link to the challenge: