JS在構造函數和實例化時須要注意的3種屬性

JS在構造函數和實例化時涉及到的3種屬性,分別是靜態屬性、原型屬性和實例屬性。web 靜態屬性 function Foo(){} var f1=new Foo(); Foo.count=0; //靜態屬性 Foo.count++; console.log(f1.count);//undefined console.log(Foo.count);//1 靜態屬性也能夠說對
相關文章
相關標籤/搜索