A SIMPLE JS OBJECT AND ACCESS VIA DOT NOTATION. • An object, person1, with two property slots and one method slot.
//testable via console
var person1 = {
lastName : "Dear",
firstName : "Stuart",
getFullName : function () {
return this.firstName + " " + this.lastName;
}
};
person1.firstName;
//Outputs : "Stuart"
person1.lastName;
//Outputs : "Dear"
person1.getFullName();
//Outputs : "Stuart Dear"
//TEMPLATE / Object Scaffold
var <<objName>> = {
<<dataPropertyName>> : "<<value>>",
<<dataPropertyName>> : "<<value>>",
<<methodPropertyName>> : function () {
return this.<<//someVariable>>;
}};