摘要:
1 function Father(name) { 2 this.name = name; 3 } 4 Father.prototype.say = function () { 5 return this.name; 6 } 7 function Son(name, age) { 8 Father.call(this, name); 9 this.age = age;10 }11 ... 阅读全文
摘要:
1 //简单的函数调用 2 function Father() { 3 this.nums= [1,2]; 4 } 5 function Son() { 6 Father.call(this);//调用超类型,完成son继承father 7 } 8 var s1 = new Son(); 9 s1.nums.push("yellow");10 alert(s1.nums);//red,black,yellow11 va... 阅读全文