Ho creato questo blocco di codice in 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());
Non so perché, ma quando l'eseguo, Firefox è il congelamento. Ho cercato ore di capirlo. E la mia ipotesi è ci dovrebbe essere un loop infinito nel mio codice e vive da qualche parte nel se la condizione, ma non ho trovato fuori. Qualcuno potrebbe darmi una mano di questo mal di testa. Grazie!