Map-the-debris challenge not working? // solved


Could you please investigate if something is wrong with map-the-debris challenge, I have written the below solution that returns correct ouput but the challenge is not accepting it, tried the outcommented part as well, and also tried to pass text strings as output which did not work either.

function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  var answer = [];

  for (var i = 0; i < arr.length; i++) {
    var T  = Math.round(2 * Math.PI * Math.pow((Math.pow(arr[i].avgAlt + earthRadius, 3) / GM), 0.5));
    arr[i].avgAlt = T;
    /*var temp = {
    name: arr[i].name,
    avgAlt: T
  return arr;

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

Thanks in advance!

The object you’re returning has one of its properties with the wrong name. avgAlt should be orbitalPeriod in the output.

1 Like

Hi @kevcomedia, thank very much, totally missed this one!