JavaScript Object Type
Creation
We know that objects are a collection of properties where each property has a name (also called key) and a value. The syntax for defining objects is written below.
const object = {propertyName: value,propertyName2: value2,}
Objects are written as properties wrapped by curly braces. Each property is separated by a comma. Each property has a name and a value that is separated by a colon symbol.
We can use a shorthand notation if a property name has a value with the same identifer as shown below.
const title = "A Memory of Light"const authors = ["Robert Jordan", "Brandon Sanderson"]const book = {title,authors}console.log(book.title) // "A Memory of Light"
Mutability
Objects are complex reference types, which means that we can add, modify or delete properties of the object while still keeping teh same reference. Even objects bound to constants are prone to mutation.