Local scope bug in IE9 javascript evaluator

by ewout

I recently experienced a what-the-fuck-moment when testing some javascript code on internet explorer. All ran well on IE6 upto 8, but not in IE9. After a bit of fiddling, I was able to create a small failing example.

function fail() {
  var p = {}
  var c = p.c = [];
  c.push({r: (c = [])})
  alert(JSON.stringify(p.c)); // should be [{"r":["lala"]}], but is [] in IE9

Looks like a bug to me. Just putting it out here, since I did not find a place on the Microsoft site to report bugs for IE9.

Fork me on GitHub