Tell us what’s happening:
I need help with an es6 challenge:
so what’s going on is I wrote the code below in the function and the console kept returning the error: “destructuring with reassignment was used”
Your code so far
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
function getTempOfTmrw(avgTemperatures) {
"use strict";
// change code below this line
const {tomorrow : newT} = avgTemperatures; // change this line
// change code above this line
return newT;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36.
I redid the code, but the console kept returning that tempOfTomorrow wasn’t defined.
here is the code and by the ways, thanks for telling me about the above and below line code @ilenia.
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
function getTempOfTmrw(avgTemperatures) {
"use strict";
// change code below this line
const {AVG_TEMPERATURES} = tempOfTomorrow; // change this line
// change code above this line
return tempOfTomorrow;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79