Objects
> var d = [];
<-:undefined
> typeof(d);
<-:"object"
> var e = {};
<-:undefined
> typeof(e);
<-:"object"
> var f = null;
<-:undefined
> typeof(f);
<-:"object"> var f = null;
> (!f && typeof f === 'object')
<-: trueLast updated
> var d = [];
<-:undefined
> typeof(d);
<-:"object"
> var e = {};
<-:undefined
> typeof(e);
<-:"object"
> var f = null;
<-:undefined
> typeof(f);
<-:"object"> var f = null;
> (!f && typeof f === 'object')
<-: trueLast updated
var e = {}; //object literal notationvar e = new Object();> var person = {
"firstName":"John", // Property
"lastName":"Wick", // Property
"getFullName": function(){ // Method
return this.firstName + this.lastName;
}
};
<-:undefined
> person;
<-:Object {firstName: "John", lastName: "Wick", getFullName: function}
> person.firstName; // Access object property using key
<-:"John"
> person["firstName"] // Another way to access like array
<-:"John"
> person.getFullName() // Calling method
<-:"JohnWick"