Use Destructuring Assignment to Assign Variables from Nested Objects

Tell us what’s happening:

Your code so far

  today: { min: 72, max: 83 },
  tomorrow: { min: 73.3, max: 84.6 }

function getMaxOfTmrw(forecast) {
  "use strict";
  // change code below this line
  const { tomorrow : { max : maxOfTomorrow}} = LOCAL_FORECAST; // change this line
  // change code above this line
  return maxOfTomorrow;

console.log(getMaxOfTmrw(LOCAL_FORECAST)); // should be 84.6

Your browser information:

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

Link to the challenge:

Alright, this makes no sense. I did USE nested destructing as you can see in the code above and I am getting the right answer for the question but I cannot advance because it says that I did not use nested destructing although, as you can see above, I did. It even says in the console that I am using nested destructing. Is this simply a glitch on FCC’s side or am I missing something big here?

You’re supposed to destructure the passed variable (forecast), not the global constant (LOCAL_FORECAST). Yes, in this case they are the same thing, but that was not the assignment.

I was missing something big here. Thankyou for answering me now and back when I had a question about why my API wasn’t working :joy:! You are extremely helpful.

That’s why we’re here. I’m just a little higher up the ladder than you are. We all help the guys and gals below and rely on the ones above us.

I’ve ran into the same issue :smiley: Thanks a lot for both of you! :slight_smile:

Thanks a lot. This was really helpful