JS Classes - Prototype

JS Classes - Prototype

by BinaryAcid

JavaScript

function Cat(name){
    this.name = name;
}

Cat.prototype.meow = function(){ 
    document.write("meow, i'm " + this.name); 
}     
        
var spot = new Cat('spot');
spot.meow();