Destructuring Assignment and assigning variables from objects

Hello, I don’t understand why I can’t pass the test in this challenge. It says I’m not using destructuring with reassignment but I am. Or am I…?

  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;

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

Thank you for help.

There’s a difference between an argument and a parameter.

1 Like

The function takes an argument avgTemperatures. What happens if you do:

getTempOfTmrw({today: 60, tomorrow: 62})

That should work fine, but in your code it won’t

1 Like

Thank you, I have managed to solve it. Like you said, the fact that parameter and argument are very similar in this challenge makes it very confusing for beginners like me.

1 Like

Great that you’ve done it and got that beautiful window with a green sign of success appearing on your screen.

Good Luck & Happy Coding.

1 Like