# Map The Debris - Code returning right values but not passing tests

**URL:** <https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792>\
**Category:** General\
**Created:** [November 27, 2016, 11:12pm UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792 "2016-11-27T23:12:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidTheProgrammer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/davidtheprogrammer/32/163280_2.png) [@DavidTheProgrammer](https://forum.freecodecamp.org/u/DavidTheProgrammer)\
**Post date:** [November 27, 2016, 11:12pm UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792/1 "2016-11-27T23:12:43Z")

</div>

Okay, so I have pasted my code below, and I need some help figuring this out **I’m not looking for a code solution**. I’ve handled all the calculations and the values returned are correct. The only difference I have noted is that the expected results all have _unquoted_ Object keys, I don’t even know if that’s possible.

```
var GM = 398600.4418;
var earthRadius = 6367.4447;

function orbitalPeriod(arr) { 
  var finalArr = [];
  
  arr.forEach(function(obj){
    let OP = orbitalP(obj.avgAlt);
    delete obj.avgAlt;
    obj.orbitalperiod = OP;
    finalArr.push(obj);
  });
  
  
  return finalArr;
}

function orbitalP(alt){
  var OR = earthRadius + alt;
  var OP = 2 * Math.PI * (Math.pow((Math.pow(OR, 3)/GM),0.5));
  return Math.round(OP);
}  

```

So that’s my code, it works fine but I just can’t seem to pass the tests. Any assistance is welcome.

---

<div class="post-metadata">

**Author:** ![DavidTheProgrammer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/davidtheprogrammer/32/163280_2.png) [@DavidTheProgrammer](https://forum.freecodecamp.org/u/DavidTheProgrammer)\
**Post date:** [November 27, 2016, 11:25pm UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792/3 "2016-11-27T23:25:30Z")

</div>

Thank you for the response. I have just tried to move the variables inside, still not working.

---

<div class="post-metadata">

**Author:** ![DavidTheProgrammer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/davidtheprogrammer/32/163280_2.png) [@DavidTheProgrammer](https://forum.freecodecamp.org/u/DavidTheProgrammer)\
**Post date:** [November 28, 2016, 12:17am UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792/4 "2016-11-28T00:17:23Z")

</div>

Oh my. Fixed it. turns out I didn’t camelCase `obj.orbitalperiod` that’s why I couldn’t pass the tests lol. this is embarrassing. Once i put `obj.orbitalPeriod` everything worked lol.

---

<div class="post-metadata">

**Author:** ![DavidTheProgrammer](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/davidtheprogrammer/32/163280_2.png) [@DavidTheProgrammer](https://forum.freecodecamp.org/u/DavidTheProgrammer)\
**Post date:** [November 28, 2016, 12:43am UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792/6 "2016-11-28T00:43:30Z")

</div>

Hahahaha amateur hour

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 6:09am UTC](https://forum.freecodecamp.org/t/map-the-debris-code-returning-right-values-but-not-passing-tests/59792/7 "2021-01-16T06:09:59Z")

</div>

Closed on January 16, 2021, 6:09am UTC


