Giving correct output on Repl but not accepted by FCC

Tell us what’s happening:
I wrote this code for this challenge and it’s not passing any test cases even though I’m getting the output as mentioned in test cases when I run the code in
Please have a look and tell me what’s wrong.

Your code so far

function orbitalPeriod(arr) {
var pii = Math.PI;

root = (arg) => Math.sqrt(arg)

formula = (a, mu) => 2*pii*root((Math.pow(a, 3))/mu);

var GM = 398600.4418;
var earthRadius = 6367.4447;

for(var i = 0; i < arr.length; i++){
  var a = earthRadius + arr[i].avgAlt;
  var mu = GM;
  var val = Math.round(formula(a, mu));

  delete arr[i]["avgAlt"];
  arr[i]["orbitalPeriod"] = val;
return arr;

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/77.0.3865.120 Safari/537.36.

Challenge: Map the Debris

Link to the challenge:

You need to check your browser’s console. You have two errors you need to address.

If you may, please mention those two errors because I’m really stuck searching.

Do you know how to check the browser console for error messages? If not, review the following lesson and see if that helps you out.

1 Like

Thanks for the support and this super fast help. I’m really thankful. I’m looking into the lesson.

I got it!! I didn’t mention the var before initiating the arrow functions. Thank you!

The tests use “strict” mode. You can add “use strict” to the first line in and you would see similar messages.

1 Like

Okay. I’ll try that.