Having an issue on Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:
It’s failing the “destructuring with reassignment was used” test, and I’m at a loss as to why.

Your code so far


const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {tomorrow: tempOfTomorrow} = AVG_TEMPERATURES // change this line
  // change code above this line
  return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects

JK, y’all. Just changed “AVG_TEMPERATURES” to “avgTemperatures” and everything works. Jeez.

1 Like

It is an unfortunate wording, but remember that when you are in the function scope you should always reference function parameter and not a global value

1 Like

Yeah, I had been staring at it for too long. Walked away for a minute, came back and realized the issue. Thank you though.

1 Like