Hi, if I have an object constructor like:
function cat(color, sex){
this.color = color;
this.sex = sex;
}
and I make some cats:
var fluffball = new cat("blue","male");
var shiznitz = new cat("red","male");
var slothersburger = new cat("green","female");
Is it possible to loop through all the cats I have declared? Something like:
var current_cat;
for(current_cat in document.cat){
alert(current_cat.color);
}
That doesn't work though. Do people usually store all the cat objects in an array? Or make another object containing an array of the individual cats:
function all_cats(){
this.the_cats = new Array();
}
Thanks for any tips!