Tsallaka zuwa abun ciki
Justice Tech School

Objects: Properties and Methods

Objects store key value pairs. Read with dot or bracket notation, add and delete properties and use shorthand when the variable name equals the key.

Example
const name = "Ada";
const user = { name, age: 30, greet() { return "Hi " + this.name; } };
user.city = "Lagos";
delete user.age;
console.log(user, user["city"], user.greet());

Exercise

Read a key by name.

user[]

Quiz Test

How do you delete a property?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.