I don't understand what's wrong: Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:
I’ve been looking at a lot of the responses and questions about this topic here, but I still can’t solve my issue. I don’t know why it’s not letting me pass the challenge. As far as I know I have used destructuring. In fact, I even tested all my code on the console, and it didn’t throw any errors, and seemed to work fine. I’ve already tried using the parameter, etc and nothing is working.

I don’t understand why I need that argument or parameter, when the AVG_TEMPERATURES is a global object. Can any one please tell me what else I need to do in order for it to pass?

Your code so far


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

function getTempOfTmrw() {
  "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()); // should be 79

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 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

You made a change above the “change code below this line”, removing the function parameter. You are also accessing the global variable directly instead of using the argument variable that you deleted.

Thank you so much. I had originally tried not changing the code above, but it still wasn’t working. It turns out I was calling the global object, and didn’t realize that the casing on the global object, and the local object wasn’t the same.