Below is my solution. It is saying I haven’t used destructuring. I’m not sure what I’m doing incorrectly. I thought I had structured things exactly as was shown in the demonstration and hint.
const AVG_TEMPERATURES = {
today: 77.5,
tomorrow: 79
};
function getTempOfTmrw(avgTemperatures) {
"use strict";
// change code below this line
const { tomorrow : tempOfTomorrow, today : tempOfToday } = AVG_TEMPERATURES;// change this line
// change code above this line
return tempOfTomorrow;
}
console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79
Parameter of function getTempOfTmrw is avgTemperatures, not AVG_TEMPERATURES. Also you don’t need to think about temperature of today, only about temperature of tomorrow
But AVG_TEMPERATURES is what the test asks for. Isn’t the variable tested by a function able to be anything so long as it follows the data structure expected by the function?
First you are writing a function with parameter avgTemperatures and after you are calling that function already with AVG_TEMPERATURES. Output inside of console is 79. If your parameter is n, inside of function is visible n, but AVG_TEMPERATURES also is not visible
The problem is that you are not using the function parameter. Rather you directly use the variable. To pass the test you need to use the function parameter. If you change the parameter like this function getTempOfTmrw(n), then you, for example, use n within your function. But to pass the test you need to use the parameter they originally provided you with.