blob: b3cb55a9ced57a950754875fdea9d39027bacd4a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
function foo(a, b) {
var s = "foo";
for (var j = 0; j < 5; j++)
s += a[b[j]];
return s;
}
var a = {a:"zero", b:"one", c:"two", d:"three", e:"four"};
var b = ["a", "b", "c", "d", "e"];
for (var i=0; i<9; i++)
assertEq(foo(a, b), "foozeroonetwothreefour");
a.e = 4;
assertEq(foo(a, b), "foozeroonetwothree4");
|