Came across an interesting issue with Google Chrome's debugger today. A variable looked like it wasn't available, but it was - just not available to the debugger. Here's some example code:
<script>
var foo = function(passedInThing, otherPassedInThing) {
return {
bar: function() {
window.im_using = passedInThing;
debugger;
}
}
}
foo("this exists", "this does not").bar();
</script>
Because I've made a reference to passedInThing within the scope of the inner function, the debugger can see that variable and manipulate it. But otherPassedInThing seems to be invisible until it is used.
As far as I can tell, firefox doesn't seem to have the same limitation. Is this a bug, or is there some rationale behind this?