Skip to the content.

Summary

WHAT IS AN OBJECT?

Objects: group together a set of variables and functions to create a model of a something you would recognize from the real world. In an object, variables and functions take on new names.

In JavaScript:

Example var hotel = { name: ‘Quay’, rooms : 40, booked: 25, checkAvailability: function() { return this.rooms - this.booked; } } ; JAVASCRIPT var elName = document .getElementByld(‘hotelName’); elName.textContent =hotel .name; var elRooms = document.getElementByid{‘rooms’); elRooms .textContent = hotel .checkAvailability();

image

Summay

Document object model

image