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: maximum}} = forecast;
const maxOfTomorrow = maximum; // change this line
// change code above this line
return maxOfTomorrow;
}
console.log(getMaxOfTmrw(LOCAL_FORECAST)); // should be 84.
What is wrong with my code ? i cant get this right “nested destructuring was used”
There is no need for the following line:
const maxOfTomorrow = maximum;
Think about it for a bit and think what you could replace maximum with in your destructuring line of code.
Yesss… you are right , i replaced maximum with maxOfTomorrow and it worked , Thanks alot .
And…
const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["id-blacklist", "no-dup-keys"]
};
function makeList(arr) {
"use strict";
// change code below this line
const resultDisplayArray = [];
for(let i = 0; i < result.failure.length; i++){
resultDisplayArray.push(`<li class="text-warning">${result.failure[i]}</li>`);
}
// change code above this line
return resultDisplayArray;
}
/**
* makeList(result.failure) should return:
* [ <li class="text-warning">no-var</li>,
* <li class="text-warning">var-on-top</li>,
* <li class="text-warning">linebreak</li> ]
**/
const resultDisplayArray = makeList(result.failure);
can you spot the error here ??
use arr in place of result.failure.