1 2 3 4 5 6 7 8 9 10 11 12
var log; function b(x) { log += 'b'; return 'B'; } function g() { log = ''; var a = {toString: function () { log += 'a'; return 'A'; }}; assertEq("[" + a + b() + "]", "[AB]"); assertEq(log, "ab"); } for (var i = 0; i < 1000; ++i) g();