How to use nested destructuring

Well do i got a Bugg here, or did i something wrong? You can see my code below.
It tells me allways:“nested destructuring wasnt used”, but i think i used it.

My 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 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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36.

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

Hi @TheOneWayTruth

You’re correct, you did use nested destructing, I think the problem is that your destructing the global object (LOCAL_FORECAST), when I suspect the challenge wants you to use the local function parameter (forecast)

4 Likes