michael@0: function foo(a, b) { michael@0: var s = "foo"; michael@0: for (var j = 0; j < 5; j++) michael@0: s += a[b[j]]; michael@0: return s; michael@0: } michael@0: michael@0: var a = {a:"zero", b:"one", c:"two", d:"three", e:"four"}; michael@0: var b = ["a", "b", "c", "d", "e"]; michael@0: michael@0: for (var i=0; i<9; i++) michael@0: assertEq(foo(a, b), "foozeroonetwothreefour"); michael@0: michael@0: a.e = 4; michael@0: assertEq(foo(a, b), "foozeroonetwothree4");