my solution seems to return an array of all correct values for avgAlt but does not pass any of the tests.
I can’t seem to figure out what I am missing here. Any help would be good.
here is my code:
function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
let time = (avgAlt) => {
return Math.round(
(2*Math.PI) * (Math.sqrt((Math.pow((avgAlt + earthRadius), 3) / GM)))
);
}
return arr.map(e => {
e.avgAlt = time(e.avgAlt);
return e;
});
}
/*
output for: orbitalPeriod(([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}])):
[ { "name": "iss", "avgAlt": 5557 }, { "name": "hubble", "avgAlt": 5734 }, { "name": "moon", "avgAlt": 2377399 } ]
*/
Thanks
Steven