Ik maak dit blok code 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());
Ik weet niet waarom, maar wanneer ik het in werking, firefox is bevriezen. Ik heb geprobeerd uur om het te achterhalen. En ik denk, moet er een oneindige loop in mijn code en het leeft ergens in de if conditie, maar ik heb het niet te weten. Kan iemand me helpen uit deze hoofdpijn. Dank je!