Not a problem, because I found out what causes it, but still a huge quirk:
Obviously, when you create a closure, the JavaScript engine does not preserve all scope variables. It saves only those that are actually used by the internal function. This leads to incorrect results in the debugger if you stop your program. Here is how you can reproduce this
1. Run the following snippet in Chrome:
function foo (){ var id = 0 var id2 = 1 return function foo2(){
Note that only id2 is defined in the close area: 
2.Remove the console.log statement.
There are now two variables in the closing area 
Does anyone know why this is happening (I believe this is a memory), and are there other aspects of this that we should be aware of.
source share