michael@0: function test() { michael@0: var a = ['x', '', '', '', '', '', '', 'x']; michael@0: var b = ''; michael@0: for (var i = 0; i < a.length; i++) { michael@0: (function() { michael@0: a[i].replace(/x/, function() { return b; }); michael@0: }()); michael@0: } michael@0: } michael@0: test(); // should NOT get a ReferenceError for b on trace