Tell us what’s happening:
Describe your issue in detail here.
What is actually incorrect in this code? console.log returns correct answers in both cases of tests. I am sorry to disturb you, but… if it is all about type of quotation marks it is kind of sad…
Your code so far
function orbitalPeriod(arr) {
let newArr =
const GM = 398600.4418;
const earthRadius = 6367.4447;
for (let p of arr) {
orbitalPeriod = Math.round(2Math.PIMath.sqrt(Math.pow(p.avgAlt+earthRadius,3)/GM))
newArr.push({name: p.name, orbitalPeriod: orbitalPeriod})
}
console.log(newArr)
return newArr;
}
orbitalPeriod([{name: “iss”, avgAlt: 413.6}, {name: “hubble”, avgAlt: 556.7}, {name: “moon”, avgAlt: 378632.553}]);
function orbitalPeriod(arr) {
let newArr = []
const GM = 398600.4418;
const earthRadius = 6367.4447;
for (let p of arr) {
orbitalPeriod = Math.round(2*Math.PI*Math.sqrt(Math.pow(p.avgAlt+earthRadius,3)/GM))
newArr.push({name: p.name, orbitalPeriod: orbitalPeriod})
}
console.log(newArr)
return newArr;
}
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/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Challenge Information:
Intermediate Algorithm Scripting - Map the Debris