blob: f11311945d1e6660b474ff27ab9f7ed6df592b2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
var Test = function (foo) {
var a = [];
this.fillArray = function() {
a = [];
for (var i = 0; i < 10; i++)
a.push(0);
assertEq(a.length, 10);
}
foo.go(this);
};
// Import assertEq now to prevent global object shape from changing.
assertEq(true, true);
(new Test({ go: function(p) {
p.fill = function() {
p.fillArray();
}
}})).fill();
new Test({ go: function(p) {
for (var k = 0; k < 10; k++)
p.fillArray();
}});
|