通過new+func名創建的對象,這個對象可以直接調用或訪問func.prototype創建的屬性或方法,這就是所謂的繼承
舉例說明:
function a(age){this.age=age;} var anobj=new a("22"); a.prototype.old=function(){alert("Hello,I am"+this.age+"years old");} anobj.old();