Below are some code
var Foo=function(){
this.doSomething1=function(){
//do something
}
};
Foo.prototype.doSomething2=function(){
//do something
};
if I change it to
var Foo=function(){
};
Foo.prototype.doSomething1=function(){
//do something
};
Foo.prototype.doSomething2=function(){
//do something
};
the second block of code almost can do any thing same as the first one. but it has very clear inherit relationship on prototype chain.
What is the advantage for the first code block?
Your comment welcome