Ecma Script 6 #13

Why my code wrong?
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: {min,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: <code>Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0</code>.

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

You shouldn’t set your const to the global const LOCAL_FORECAST. Use the parameter that’s passed inside to the function.

1 Like