Use Destructuring Assignment to Assign Variables from Objects (HEELLPP PLEASE!)

Tell us what’s happening:

I just fully don’t understand how to solve this piece of coding and i would like some assistance on how to do so

thank you

Your code so far


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

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects/

Based on the code provided you are just assigning the AVG_TEMPERATURES object to your tempOfTomorrow. So now when you are returning tempOfTomorrow you are actually returning the same object. For this challenge you only want to return tomorrow’s temperature.

So think of it as pulling out the object property tomorrow and copying it into tempOfTomorrow. This is shown semantically as follows:

{ tomorrow : tempOfTomorrow } = avgTemperatures