Use Destructuring Assignment to Assign Variables from Objects - why avgTemperatures not AVG_TEMPERATURES?

I have just been working through this challenge and was getting
“destructuring with reassignment was used” thrown up as an error even though my code looked good (I think, I have attached a photo). Then I noticed the var name used in the function “getTempOfTmrw” was “avgTemperatures” but this does not match the name of the object at the top of the code “AVG_TEMPERATURES”. When I changed the the “AVG_TEMPERATURES” at the end of the of my deconstruction line to “avgTemperatures” it worked.

Would anyone be able to explain why it has to be “avgTemperatures” to work please?

you should always use the paramenters of the function instead of global variables. It is the only way to make reusable code.

The test is not worded splendidly, but that is the reason why using the global object is wrong

Thank you, that makes sense. It confused me because I couldn’t see a link between the constant AVG_TEMPERATURES and the function so I thought that I must have to use the global variable. But I will keep that in mind going forward!

last line of the code, the global object is passed in the function call