Use Destructuring Assignment to Assign Variables from Objects0

Tell us what’s happening:
Please help me out with this below code. I did not understand the topic. Thanks in advance

Your code so far

  today: 77.5,
  tomorrow: 79

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const { tempOfTomorrow : a} = 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 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:

You are destructuring property tempOfTomorrow of the object in variable a, when you need to destructure property tomorrow in variable tempOfTomorrow
Try rereading instructions if you can manage doing it on your own

Plus, when you are in a function try always referencing the function parameter and not a global value

1 Like