Without Prototype : Lots of memory per object
- Each time when you create object from below vehicle function,
- the line function(name){ this.name = name; } is alocated memory each time the object is created,
- so there are multiple instances of same function.
function vehicle(){
this.name = 'truck';
this.set_name = function(name){
this.name = name;
}
}
var taxi = new vehicle();