Destructuring assignments to assign variables:test cases are not passed

Tell us what’s happening:

When i run the test,the resuts shows me this “destructuring with reassignment was used”.
What is wrong with this code?

Your code so far

  today: 77.5,
  tomorrow: 79

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const { tomorrow  : tempOfTomorrow } = AVG_TEMPERATURES;
  // 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:

Hey @divyadivya ,

You are creating your function in manner that it will work only on AVG_TEMPERATURES object.
But, what if there was another object like :

  today: 75.5,
  tomorrow: 80

You will have to write function for that too.
So, you should use the argument passed in your function instead of actual object name and your function will be applicable for every object.
Does this help?

1 Like

Thank you !