The problem was isolated to a leaking of the local variable out into the global context. You can see this if you try the following program: When the function executes the alert displays 0,0,0 which ...