Link Search Menu Expand Document

Modify an Object Nested Within an Object

Summary

  • Object properties can be nested to an arbitrary depth, and their values can be any type of data supported by JavaScript.

Final Code

let userActivity = {
  id: 23894201352,
  date: 'January 1, 2017',
  data: {
    totalUsers: 51,
    online: 42
  }
};

// Only change code below this line
userActivity.data.online = 45;
// Only change code above this line

console.log(userActivity);