Destructuring Assignment to Assign Variables

Tell us what’s happening:

I don’t know why I am getting this wrong on the challenge, I think destructuring with reassignment was used in my code but I still can’t pass the challenge

Your code so far

  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

Though technically you should be able to use AVG_TEMPERATURES because it is a global variable, the tests are expecting you to use a different variable. Think about a variable which is local to the getTempOfTmrw function which is the same object AVG_TEMPERATURES.

1 Like

Thank you sir, I changed the AVG_TEMPERATURES to avgTemperatures for passing the parameter… haha