给定如下的类定义,我RangeError: Maximum call stack size exceeded
在尝试查看 Object 具有哪些属性时得到。
var Person = (function () {
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.inspect = function () {
console.log(this);
};
return Person;
})();
var radek = new Person("Radek", 28);
radek.inspect();
在浏览器(Chrome)中,我们将得到以下内容:
Person {name: "Radek", age: 28, inspect: function}