mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-29 20:57:43 -10:00
15 lines
400 B
JavaScript
15 lines
400 B
JavaScript
function testCallProtoMethod() {
|
|
function X() { this.x = 1; }
|
|
X.prototype.getName = function () { return "X"; }
|
|
|
|
function Y() { this.x = 2; }
|
|
Y.prototype.getName = function() { return "Y"; };
|
|
|
|
var a = [new X, new X, new X, new X, new Y];
|
|
var s = '';
|
|
for (var i = 0; i < a.length; i++)
|
|
s += a[i].getName();
|
|
return s;
|
|
}
|
|
assertEq(testCallProtoMethod(), 'XXXXY');
|