This repository has been archived on 2023-11-10. You can view files and clone it, but cannot push or open issues or pull requests.
freecodecamp-projects/2-javascript-algorithms-datastructures/0-somechallenges/orbitalPeriod.js

15 lines
406 B
JavaScript
Raw Normal View History

function orbitalPeriod(arr) {
const GM = 398600.4418;
const earthRadius = 6367.4447;
let orbitalPeriod = 0;
const response = [];
for (let elem in arr){
let avgAlt = arr[elem]['avgAlt'];
let name = arr[elem]['name'];
response.push({name: name, orbitalPeriod: orbitalPeriod})
}
return response;
}
orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]);