Use Destructuring Assignment to Assign Variables from Nested Objects hint wrong

Tell us what’s happening:

The hint section of this lesson indicates an incorrect answer as the solution. It suggests

const {
  tomorrow: { max: maxOfTomorrow }
} = forecast;

is the answer, but it isn’t.

Your code so far


const LOCAL_FORECAST = {
yesterday: { low: 61, high: 75 },
today: { low: 64, high: 77 },
tomorrow: { low: 68, high: 80 }
};

// change code below this line


const {today:{high:highToday, low:lowToday}}=LOCAL_FORECAST;
// change code above this line

console.log(lowToday); // should be 64
console.log(highToday); // should be 77

Your browser information:

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

Challenge: Use Destructuring Assignment to Assign Variables from Nested Objects

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

1 Like

It must a hint to an older challenge.

That was my first thought as well. I figured it was still worth pointing out so whoever can correct it would now be aware to do so.

I have updated the guide.

Thank you very much!