Я создаю этот блок кода в JavaScript:
function Shape() {}
Shape.prototype.name = Shape;
Shape.prototype.toString = function() {
result = [];
if(this.constructor.uber) {
result[result.length] = this.constructor.uber.toString();
}
result[result.length] = this.name;
return result.join(', ');
}
function twoDShape() {};
twoDShape.prototype = new Shape();
twoDShape.prototype.constructor = twoDShape;
twoDShape.uber = twoDShape.prototype;
twoDShape.name = twoD Shape;
var a = new twoDShape();
console.log(a.toString());
Я не знаю, почему, но когда я запускаю его, светлячок замораживания. Я пытался часов, чтобы понять это. И я думаю, должна быть бесконечной петли в моем коде, и он живет где-то в состоянии, если, но я не нашел его. Может кто-то помочь мне от этой головной боли. Спасибо!