Use Destructuring Assignment to Assign Variables from Objects - md1285

Tell us what’s happening:

I can’t for the life of me figure out why the below code is not registering as correct. It is assigning the variable correctly, but “destructuring with reassignment was used” is not registering, even though as far as I can tell I am using destructuring like in the example. Anyone have any clues?

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

You need to use the function parameter

2 Likes