Tell us what’s happening:
Your code so far
function orbitalPeriod(arr) {
let GM = 398600.4418;
let earthRadius = 6367.4447;
let orbit = 2 * Math.PI * Math.sqrt(Math.pow(earthRadius + arr.avgAlt, 3)/GM)
delete arr.avgAlt
arr.orbitalPeriod = Math.round(orbit)
return arr;
}
console.log(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris
When i log the test to the console in the code above, my orbit variable is NaN. I can’t understand why that would be i’m only working with numbers here. Also, the delete operator is not deleting the avgAlt key. Before i go looking at the solution I’d like to know why the above is not working, any input would be appreciated.