Skip to content

Instantly share code, notes, and snippets.

@eggie5
Created August 5, 2010 22:54
Show Gist options
  • Save eggie5/510545 to your computer and use it in GitHub Desktop.
Save eggie5/510545 to your computer and use it in GitHub Desktop.
var sys=require('sys');
var mamlib=require('./mammal');
console.log(sys.inspect(mamlib));
=> {}
WHY???
function Mammal(name){
this.name=name;
this.offspring=[];
}
Mammal.prototype.haveABaby=function(){
var newBaby=new Mammal("Baby "+this.name);
this.offspring.push(newBaby);
return newBaby;
}
Mammal.prototype.toString=function(){
return '[Mammal "'+this.name+'"]';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment