[help]Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:
I do everything right but do not get successful. It said that destructuring with reassignment wasn’t used

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 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

1 Like

The code is technically using destructuring, but the source object is expected to be the avgTemperatures parameter, not the AVG_TEMPERATURES global object.

1 Like