function getTempOfTmrw(avgTemperatures) {
“use strict”;
// change code below this line
const tempOfTomorrow = AVG_TEMPERATURES.tomorrow;// change this line
// change code above this line
return tempOfTomorrow;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79
It appears that this challenge has changed some since you have started working on it. I just visited the page and the AVG_TEMPERATURES object is a bit simpler than in your code shown above. So the new solution no longer requires a complex nested destructuring.
I believe that you are doing the destructuring assignment correctly but you are destructuring the wrong thing.
The function accepts one argument locally named avgTemperatures. That is what you should be destructuring, not the global object AVG_TEMPERATURES. That way you could call the function on any temperature object, not just that particular one.
const AVG_TEMPERATURES_ALASKA = {
today: {low : 27, high: 36 },
tomorrow: {low : 32, high :40}
};
// this would not work the way you are doing it
console.log(getTempOfTmrw(AVG_TEMPERATURES_ALASKA)); // sb 40 but would get 79 for any argument