object {}
Try it yourself →Stores key-value pairs.
Syntax
const name = { key: value }Description
Objects are created using curly braces. Values are accessed with dot notation (object.key) or square brackets (object['key']).
Returns
Object.
Example
const person = { name: "Alex", age: 36 };
console.log(person.name);
person.city = "London";
console.log(person);Expected output
Alex
{ name: 'Alex', age: 36, city: 'London' }When to use?
Storing entity properties (user, product); JSON data.