摘要:
测试代码:function Dog(name) { this.name = name; Dog.prototype = { shout: function() { alert("I am " + this.name); } };}var dog1 = new Dog("Dog 1");dog1.shout();上面的代码看起来很“优美”,可一运行,却报错:“Object doesn’t support this property or method”. 对于代码:Fn() {};var fn = new Fn();new Fn() 的实际构造过程可以等价 阅读全文