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(…)
慕码人8056858
相关分类