D
disappearedng
Hi everyone
It's me again,
this time I am trying to write a function that copies all the fields
from one object to another and supplementing all these fields with the
value null
How do I go about it?
var myMammal = {
name : 'Herb the Mammal',
get_name : function() {
return this.name;
},
says : function() {
return this.saying || '' ;
}
};
var copyfields = function(fromZ, toZ){
for (var name in fromZ)
toZ[name] = "null";
};
Firebug complains about toZ not defined. I understand that this is
because of toZ is undefined from the perspective of each "name" in
fromZ.
How do I go about this?
It's me again,
this time I am trying to write a function that copies all the fields
from one object to another and supplementing all these fields with the
value null
How do I go about it?
var myMammal = {
name : 'Herb the Mammal',
get_name : function() {
return this.name;
},
says : function() {
return this.saying || '' ;
}
};
var copyfields = function(fromZ, toZ){
for (var name in fromZ)
toZ[name] = "null";
};
Firebug complains about toZ not defined. I understand that this is
because of toZ is undefined from the perspective of each "name" in
fromZ.
How do I go about this?