The catch with try...catch
http://weblog.bocoup.com/ http://benalman.com/
by Ben Alman
JavaScript
// I just happened to have a lot of made-up vars for testing.
var a = 'foo';
var b = 1;
var c = true;
var d = false;
var e = {a: 1, b: 2};
var f = [3, 4, 5];
try { /* unimportant */ } catch(e) { /* unimportant */ }
// Everything logs fine, everywhere.
console.log(a, b, c, d, e, f);
function test() {
try { /* unimportant */ } catch(e) { /* unimportant */ }
// Wait, why is `e` logging as undefined in IE 6-8 ?!
console.log(a, b, c, d, e, f);
}
test();