Usage of Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:

Not sure if there is a bug here, but I’m still getting a ‘X’ for " destructuring with reassignment was used". I feel like I understand the concept appropriately but still cannot get it to pass. Thanks 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 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:

You are not using the argument variable that was passed into your function.

Could you please provide the correct code? Perhaps I still don’t understand, but I followed this closely and thought that I did.

The function getTempOfTmrw gets an parameter avgTemperatures. You are not using this parameter anywhere in your code.

Thank you. The use of so many similar variations of words and capitalizations was manifesting my Caps dyslexia. The correct code for other readers:

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.

1 Like