Destructuring Assignment problem

Use Destructuring Assignment to Assign Variables from Objects
I’am asked to
Use destructuring to obtain the average temperature for tomorrow from the input object AVG_TEMPERATURES , and assign value with key tomorrow to tempOfTomorrow in line.

I tried this code :
today: 77.5,
tomorrow: 79

function getTempOfTmrw(avgTemperatures) {
“use strict”;
// change code below this line
const {tomorrow: tempOfTomorrow } = AVG_TEMPERATURES; // change this line
// change code above this line
return tempOfTomorrow;


but still I have the error : destructuring with reassignment was used

Can you provide a link to the challenge? I tried to look it up but the challenge I find looks very different from what you have.

1 Like

seems you may be mis-reading. You aren’t asked to use AVG_TEMPERATURES for anything other than a structure reference. You’re being passed a parameter, avgTemperatures, and you’re being asked to use that.

For the record, this is a very common question on the forums, usually asked at least once or twice a week. I really suggest, before asking, that a little research on the forums might be useful. The maginifying glass icon in the menu above allows you to search, and if (in this case) you’d searched for ‘destructuring assignment’, you might find a plethora of responses.

Of course, they all say the same thing. Your code should not be aware of global variables, like AVG_TEMPERATURES - instead, you have been passed a parameter. That is the only piece of data you should be aware of, or concerned with.


Thanks a lot :blush:

Thanks but i found the solution, I should use the parameter avgTemperatures not the object AVG_TEMPERATURES for the assignment.

1 Like