Use Destructuring Assignment to Assign Variables

I think you are not getting my point.
What i am trying to say is that by using AVG_TEMPERATAURES here:

You are creating your function in manner that it will work only on AVG_TEMPERATURES object.

Yes you are.
But, what if there was another object like :

const AVG_TEMPERATURES1 = {
  today: 75.5,
  tomorrow: 80
};

?
You will have to write function for that too.
So, you should use the argument passed in your function instead of actual object name and your function will be applicable for every object.
Hope this helps.

4 Likes