Javascript 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 code above this line
  return maxOfTomorrow;

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15.

Link to the challenge:

I don’t know why it says i didn’t use nested destructuring here. Can someone help
Thanks in advance.

The test was NOT expecting you to use the global variable LOCAL_FORECAST. Use the argument passed into the function and you will be fine.

1 Like

Thank you always!!:grinning::grinning::grinning: