June 2016
Beginner
314 pages
6h 19m
English
JavaScript objects are very simple collections of name-value pairs. There are two ways of creating a simple object in JavaScript. The first way is as follows:
var obj = new Object();
And the second way is as follows:
var obj = {};
We can also create an object entirely, as follows:
obj = {
name: {
first: 'Gandalf',
last: 'the Grey'
},
address: 'Middle Earth'
};
As we can see, to declare a JavaScript object, [key, value] pairs are used, where the key can be considered an attribute of the object and the value is the attribute value. All classes that we will create in this book are JavaScript objects, such as Stack, Set, LinkedList, Dictionary, Tree, Graph, and so on.
In object-oriented programming (OOP), an object ...
Read now
Unlock full access