I need help understanding the functions of an object literally in JavaScript

I just started reading JavaScript and jQuery by John Duckett, and so far I really like the book. In the book, I participate in the introduction of functions, and I am a bit lost. What are some interesting things that I can do with simple object literals. I get how to create a simple function, but the book never gives other examples of what I can create using these functions. For instance,

var hotel = {
    name: "Quay",
    rooms: 40,
    booked: 25,
    checkAvailability: function() {
       return this.rooms - this.booked;
    }
};

I am trying to learn from this, but I continue to draw a space where I can perform these functions. I start with JavaScript, so I don’t know too much about this language.

+4
source share
1 answer

, . , , , . , .

, . , , , .

, . , ..

, , , ..

, , , , , . , .

+2

All Articles