algorithms/mapDebris.js
2024-01-12 07:01:06 -05:00

11 lines
No EOL
357 B
JavaScript

function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
arr.forEach(element => {
element.orbitalPeriod = Math.round(2 * Math.PI * Math.sqrt(Math.pow(earthRadius + element.avgAlt, 3) / GM));
delete element.avgAlt;
});
return arr;
}
console.log(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]));