A JavaScript object is a collection of named values. The values are written as name : value pairs (name and value separated by a colon).
- javascript objects are mutable
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
var person = new Object();
person.firstName = "John";
person.lastName = "Doe";
person.age = 50;
person.eyeColor = "blue";
const Animal = {
type: 'Invertebrates',
displayType: function() {
console.log(this.type);
}
};
let animal1 = Object.create(Animal);
animal1.displayType(); // Invertebrates