Need help in Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:

Your code so far

  today: 77.5,
  tomorrow: 79

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

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

can anyone plz tell me where I am going wrong with this challenge. I feel that I do not fully understand this concept. plz, help me.

What is the purpose of *n above?

HINT: You can use the following general way of thinking about destucturing objects when you need to create a new variable name which is different than the object property:

const { currentObjectPropertyName: newVariableName } = objectName;
1 Like

thank u @RandellDawson. Actually i can not understand the sentax properly but now it is clear to me, atleast in this case. thank u for your suggestion.

For ex. If you have an object like this,

const obj = {
  number: 1

The ES5 way of destructuring it was

const number = obj.number;

The modern ES6 way of destructuring would be

const { number } = obj;