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: {min:minOfTomorrow, 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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36.

Link to the challenge:

First of all, please ask a question so we don’t have to dig through your code to find the problem.

But the problem is here:

  const {tomorrow: {min:minOfTomorrow, max:maxOfTomorrow}} = LOCAL_FORECAST; // change this line

First of all, you are supposed to destructure the passed variable forecast not the global variable LOCAL_FORECAST. True, in this case they are the same thing, but it was not what was asked. And you don’t need to pull out minOfTomorrow - I’m not sure why that screws up the test, but it does.


I’m sorry for that, next time I’ll make sure to mention the question.

by the way Thanks for your help :slight_smile: