Use Destructuring Assignment to Assign Variables from Objects: I used destructuring but the test tell me I did not when run

If I wasn’t going to get a certificate I would be using something else: Time an time again I get stuck on something that should work but does not. Here, in this question, i pulled out the varibale tomorrow and saved it into tempoftomorrow from AVG_TEMPERATURES. This works. However freeCodeCamp is telling me I did not use destructing. I clearly did and think your grading system is flawed to be too strict as JavaScript is fairly forgiving.

Your code so far

  today: 77.5,
  tomorrow: 79

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const { tomorrow: tempOfTomorrow } = AVG_TEMPERATURES;
  // 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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36.

Link to the challenge:


You’re destructuring the wrong thing (on the right hand side)

You shouldn’t destructure the global variable AVG_TEMPERATURES, but instead the argument to the function, avgTemperatures


You’re supposed to destructure avgTemperatures, the parameter, rather than the global variable. It’s a bug in the challenge text, which will be fixed in the next update of the FCC codebase.

(That is assuming the relevant PR ever gets merged :angry:)


@chuckadams The PRs have been merged. We are just waiting for master to be deployed to production.

@chuckadams and @gebulmer

thank you very much guys cause I got stuck on this challenge :slight_smile:

Thank you for asking the question. i had the same question. And the answers helped

Thank you ! That was clear ! :slight_smile:

Some ES6 concepts are explained poorly, outside resources are needed to understand them.

1 Like