我們在定義函數(shù)的時候,函數(shù)定義的時候函數(shù)本身就會默認(rèn)有一個prototype的屬性;
而用new 運(yùn)算符來生成一個對象的時候就沒有prototype屬性。
我們來看一個例子,來說明這個
function a(c){
this.b = c;
this.d =function(){
alert(this.b);
}
}
var obj = new a('test');
alert(typeof obj.prototype);//undefine
alert(typeof a.prototype);//object