Use Destructuring Assignment to Assign Variables from Objects query

Tell us what’s happening:
I keep getting this error whereas i cant see any other way it can be done and need help.
error : destructuring with reassignment was 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 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 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/

The function takes an argument (avgTemperatures). You are using the test object (AVG_TEMPERATURES) used to make sure your function works instead of that argument.

thanks, i don’t know how i missed such a mistake. :slight_smile: