What is the difference of inheritance definition of the two ways below
function Rectangle(w,h){
this.width=w;
this.height.h;
this.area=function(){return this.width*this.height;}
}
and
function Rectangle(w,h){
this.width=w;
this.height.h;
}
Rectangle.prototype.area=function(){return this.width*this.height;}
I saw somebody said the first way is inefficient of use regular properties for methods that are intended to be shared by all objects of the same class.
Welcome any comment