Use Destructuring Assignment to Assign Variables from Objects challenge 1

Use Destructuring Assignment to Assign Variables from Objects challenge 1
0

#1

Problem Statement : Challenge page

Please tell me what’s wrong with my code:

const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {today: tempOfToday,tomorrow:tempOfTomorrow} = AVG_TEMPERATURES; // change this line
  // change code above this line
  return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

Destructuring with assignment is not satisfied.


#2

I will provide full solution because is more a bug on testing and not a spoiler solution.

const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {tomorrow:tempOfTomorrow} = avgTemperatures; // change this line
  // change code above this line
  return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

This has pas the test, copy this code and should work.
I believe that the server when is testing the input is expecting you to change ONLY line nr 9
const tempOfTomorrow = undefined; // change this line;
to
const {tomorrow:tempOfTomorrow} = avgTemperatures;
and nothing else.