var blah = (function(){
function ret(){
}
ret.prototype = Object.create(Object.prototype, {
getone: {
get: function() { return 1; }
},
funcstuff: function(){ console.log('funcstuff'); }
});
return ret;
})();
var b = new blah();
console.log(b.getone); // 1
b.funcstuff(); // Uncaught TypeError: Property 'funcstuff'
// of object #<Object> is not a function
我想知道使用上面添加funcstuff
到ret
原型的正确语法。Object.create()