How I can return the object from function?

Hello) I wrote the JS program to pass Intermediate Algorithm Scripting: Map the Debris, but my function returns keys as a string, how I can fix this?

function orbitalPeriod(arr) {
  var GM = 398600.4418;
  var earthRadius = 6367.4447;
  let newArr = arr.map(el => {
    var orbitalPer = Math.round(
      2 * Math.PI * Math.sqrt(Math.pow(el.avgAlt + earthRadius, 3) / GM)
    );

    return {
      name: el.name,
      orbitalPeriod: orbitalPer
    };
  });

  console.log(newArr);
}

link to quiz : https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/map-the-debris

Hi @Quintis , I’m not exactly sure what problem you’re having, the function you’ve written works perfectly. You just need to return newArr out of the function and it will pass the test.

1 Like

Thanks) it works ))))