Use Destructuring Assignment: More ES6

Tell us what’s happening:
I am unable to find the error in my code that destructures the object and assigns tomorrow’s temperature to tempOfTomorrow.

Edit: Fixed a missing colon. I’m still getting the error “destructuring with reassignment was used”

Your code so far

  today: 77.5,
  tomorrow: 79

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {today: tempOfToday, tomorrow: tempOfTomorrow} = avgTemperatures; // 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; rv:66.0) Gecko/20100101 Firefox/66.0.

Link to the challenge:

The issue is just that the tests are expecting you to destructure only tempOfTomorrow - as there is no way to check how a property value is accessed here the tests check what you have written, and can be a bit strict

Edited because of a few typos

1 Like

I see, so in the end i needed to eliminate the superfluous code for this test. Thank you!