Destructing with reassignment

Destructing with reassignment
0

Tell us what’s happening:
the test result is keep saying that destructuring with reassignment was used.
Can anyone help me? Thank in advance!

Your code so far


const AVG_TEMPERATURES = {
  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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects

Think about a variable available inside the function which has the same value as AVG_TEMPERATURES.

Ah I see. It worked when I used avgTemperatures.

But I still do not understand it. Aren’t you supposed to call tomorrow from the const AVG_TEMPERATURES?

Technically you could because it is declared globally, but the test is expecting you to use the argument passed in.