fn Function Declaration

Objects

Collections of key/value pairs — the core data structure of JavaScript.

Creating

const user = {
  name: "Ada",
  age: 36,
  greet() {
    return "Hi, I'm " + this.name;
  },
};

Accessing properties

user.name;        // "Ada"
user["age"];      // 36
user.greet();     // "Hi, I'm Ada"

Updating

user.age = 37;
user.email = "ada@example.com"; // add a new key