function MyString(str) { var newStr = [];
for(var count in str) { newStr[count] = str[count];
count++;
}; this.length = count;
return newStr;
}
MyString.prototype.abc=function(){
console.log("123")
} var s = new MyString("hello");
s.abc();瀏覽器報錯 :demo2.html:27 Uncaught TypeError: s.abc is not a function(…)
為什么在構造函數里面定義的方法--報錯
慕尼黑5688855
2018-09-13 10:09:04