原型和原型鏈

原型和原型鏈 1、構造函數—首字母一定大寫 function Foo(name,age){ this.name = name; this.age = age; this.sex = '女'; // return this;            //默認有返回行 } //創建對象 var f = new Foo('zhangsan',20); 執行過程: (1)開始執行,this變成空對象 (2)
相關文章
相關標籤/搜索