dataphage
02-10-2003, 10:01 AM
If I have a prototype object eg:
function friend(name, birthday) {
this.name = name;
this.birthday = birthday;
this.happyBirthday = function(){
document.write('<span style="color:red"><h6>...happy birthday </h6>' + this.name + '</span>')}
}
...and I call instances of that object in an array:
var m = new Array()
m[0] = tom = new friend("Tom", 8.2)
m[1] = ali = new friend("Ali", 11.24)
m[2] = james = new friend("James", 22.4)
...every time I reference the object from the array eg:
ali.happyBirthday()
...does this re-initialize the entire object or does the array simply store the object?
function friend(name, birthday) {
this.name = name;
this.birthday = birthday;
this.happyBirthday = function(){
document.write('<span style="color:red"><h6>...happy birthday </h6>' + this.name + '</span>')}
}
...and I call instances of that object in an array:
var m = new Array()
m[0] = tom = new friend("Tom", 8.2)
m[1] = ali = new friend("Ali", 11.24)
m[2] = james = new friend("James", 22.4)
...every time I reference the object from the array eg:
ali.happyBirthday()
...does this re-initialize the entire object or does the array simply store the object?