JS hasnt been easy...Someone can help in this problem?

**I have one question

Hey, how are ya all? I cant solve the problem: Map the Debris. I guess I need more comprehension on objects. Could someone debud the code below please? I think the problem is when trying to make an object out of two arrays: it is pretty hard.
Also, whats you timin on solving problems on intermediate scripting in JavaScript? I have got 2 hours to some 2 problems today and on average I spend 30 minutes on each one! If anybody can motivate me haha, please I need your help!

function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  var avgAltarr = [];
  var namesArr = [];
  var resultOp = [];
  var final =[];
  //get the AvgAlt by a for loop arr[i].avgAlt
  for(let i=0;i<arr.length;i++){
     avgAltarr.push(arr[i].avgAlt);
  }
  //get the names into another array of same length
   for(let i=0;i<arr.length;i++){
     namesArr.push(arr[i].name);
  }
  //do the math to trasnform avgAlt into orbit period
  for(let i=0;i<avgAltarr.length;i++){
     resultOp.push(Math.round(2*Math.PI*Math.sqrt(Math.pow(avgAltarr[i],3)/GM)));
  }
  //unite namesArr and results into one object
  for(var i=0;i<namesArr;i++){
    final[i]= {name: arr[i].name, orbitalPeriod: resultOp[i]};
  }
  return final[i];
}

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

**
Thanks all you guys!

Challenge: Map the Debris

Link to the challenge:

Why this termination condition?

Why return the ith?


Also, please note that the altitude is measured from the surface of the Earth, not the center.


This is a great example of why let is preferable to var. If you had used let then you would have caught the second bug I pointed out.


Once you get those three issues fixed, I would see if you can refactor your code to only use one loop. This code goes against some rules for good time/space complexity.