July 2017
Intermediate to advanced
354 pages
9h 58m
English
An object is a flexible type of data in which we can store a collection of properties consisting of pairs of keys and values, and methods are functions stored in the object. We can access the value of a property by calling the object and referencing its key. Here's an example of an object, created using the object literal definition, and how we access the cardHeight property using dot notation:
card = cardHeight: 10 cardWidth: 10 cardColor: 222222 print card.cardHeight
With the print function, we get the value of the cardHeight property by the print console.
>> 10
Functions stored in objects are called methods, and they can get parameters when ...