Challenge: Map the Debris

Tell us what’s happening:

Your code so far


function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  
   var newArr = [];
   var keyArr = [];
   newArr = arr.map(obj => {
     keyArr = Object.keys(obj);
     obj[keyArr[1]] = Math.round(2*Math.PI*
     Math.sqrt(Math.pow(earthRadius + obj[keyArr[1]], 3)/GM)) ;
     return obj;
  });
  return newArr;
}

console.log(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:

Hello everybody,
Please tell me why this program do not pass the test.

Because you return an object with a prop with a key named ‘avgalt’ instead of ‘orbitalPeriod’.

1 Like

Thank you NickEU i understood the problem.

1 Like