michael@0: function testCallProtoMethod() { michael@0: function X() { this.x = 1; } michael@0: X.prototype.getName = function () { return "X"; } michael@0: michael@0: function Y() { this.x = 2; } michael@0: Y.prototype.getName = function() "Y"; michael@0: michael@0: var a = [new X, new X, new X, new X, new Y]; michael@0: var s = ''; michael@0: for (var i = 0; i < a.length; i++) michael@0: s += a[i].getName(); michael@0: return s; michael@0: } michael@0: assertEq(testCallProtoMethod(), 'XXXXY');