JavaScript Object is an Associative
Array (Hash)
• A JavaScript object is essentially an associative array (hash)
with fields and methods, which are keyed by name
{firstname: "John", lastname: "Doe", age: 50,
tellYourage: function () {
alert(“The age is ” + this.age );
},
tellSomething: function(something) {
alert(something);
}
}
• The following two lines of code are semantically equivalent
myObject.myfield = “something”;
myObject['myfield'] = “something”;
SEE VIDEO
SEE VIDEO
0 Responses So Far: