Use Destructuring Assignment to Assign Variables from Nested Objects, is this wrong?

Use Destructuring Assignment to Assign Variables from Nested Objects, is this wrong?
0

#1

Tell us what’s happening:
I feel like my solution is correct and I even checked the hint page to find the exact same answer!
Have I made a mistake?

Your code so far


const LOCAL_FORECAST = {
  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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects


#2

You should not be referencing the global variable LOCAL_FORECAST. Use the argument passed into the getMaxofTmrw instead.


#3

D’oh. What an obvious mistake! Thank you :slight_smile: