Link Search Menu Expand Document

Use Destructuring Assignment to Extract Values from Objects

Summary

  • Destructuring assignment can be used to neatly assign values taken directly from an object.

Final Code

const HIGH_TEMPERATURES = {
  yesterday: 75,
  today: 77,
  tomorrow: 80
};

// Only change code below this line

const {today, tomorrow} = HIGH_TEMPERATURES

// Only change code above this line