Tell us what’s happening:
Omg where is the problem?
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 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 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
2 Likes
Instead of using the const LOCAL_FORECAST
, remember to use the parameter that’s passed inside the function.
4 Likes
It tell that:
nested destructuring was used
Can you paste your code after you re-tried?
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
I have that code!
Yes, so read my first reply carefully. Don’t assign the constant that’s defined on top. But use the parameter that’s passed in for you.
If you are still having trouble
const { tomorrow : { max : maxOfTomorrow}} = forecast; // change this line
1 Like
Thank you I passed the test.Thank you for helping.
1 Like
You welcome. Please mark my reply as solution so indicate your question was resolved.
Paul2
July 14, 2018, 2:02am
9
Thanks for asking the question and thank the one who answered it correctly.
2 Likes