Adding parameters



//building a constructor
function Critter(tName, tAge){
  this.name = tName;
  this.age = tAge;
  this.talk = function(){
    msg = "Hi! My name is " + this.name;
    msg += " and I'm " + this.age;
    alert(msg);
  } // end talk method
} // end Critter class def


function main(){
  //build two critters

  critterA = new Critter("Alpha", 1);
  critterB = new Critter("Beta", 2);

  //have 'em talk
  critterA.talk();
  critterB.talk();

} // end main


Andy Harris