实现ECMAScript 5中的Object.create()函数和Object.getPrototypeOf() 函数
function clone(proto) { function Dummy() { } Dummy.prototype = proto; Dummy.prototype.constructor = Dummy; return new Dummy(); //等价于Object.create(Person); } var me = clone(Person); function proto(object) { return !object? null : '__proto__' in object? object.__proto__ : /* not exposed? */ object.constructor.prototype }
更多可以参考这个教程。