Link Search Menu Expand Document

Use Destructuring Assignment to Assign Variables from Objects

Summary

  • Destructuring allows a new variable name to be assigned when extracting values.

Final Code

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

// Only change code below this line

const {today: highToday, tomorrow: highTomorrow} = HIGH_TEMPERATURES

// Only change code above this line