Map the Debris. An apparent bug

Tell us what’s happening:
My output is identical (save for the type of quotes), and yet the solution doesn’t pass. It looks like something that has to be fixed. If I need to tag some staff members, please let me know

Your code so far

function orbitalPeriod(arr) {
  const GM = 398600.4418;
  const earthRadius = 6367.4447;
  const resArr = [];
  let name;
  for (let i = 0; i < arr.length; i++) {
    name = arr[i].name;
    orbitalPeriod = Math.round(
      2 * Math.PI * Math.sqrt(
        Math.pow(arr[i].avgAlt + earthRadius, 3)
        / GM
  return resArr;

const res = orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]);

Your browser information:

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

Challenge: Intermediate Algorithm Scripting - Map the Debris

Link to the challenge:

You never declared this variable. This is causing the tests to fail.

Its important to declare your variables.

But the output is the same

But it isn’t the same when running in test mode. The undeclared variable throws an error.

Usually all undeclared variables throw errors, but you may be masking that error by recycling the same name as the function.

Yup - you picked a bad variable name which created this confusing looking result. orbitalPeriod is the name of the function, so the Monico editor is letting you get away with forgetting the declaration by counting it as a ‘variable’ since its a function name (teeeechnically it is, but not in the way you want) while the tests are much more sanely forbidding that behavior.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.