On Jan 17, 2016 12:16 AM, "Steven D'Aprano" <st...@pearwood.info> wrote: > > On Sun, 17 Jan 2016 10:25 am, jonas.thornv...@gmail.com wrote: > > > double use of j in two different functions > > Are you using a global variable called "j" as a loop variable? That sounds > like a terrible idea. > > You should use local variables. Then a function with a local variable j > cannot possibly effect another function with a local variable also called > j. > > Wait... is somebody going to tell me that Javascript defaults to global > variables inside functions?
Technically it defaults to non local. The var statement allocates a variable within the current scope. Otherwise it searches up the chain of parent scopes for a matching variable, terminating at the global scope. I believe Lua also works this way. -- https://mail.python.org/mailman/listinfo/python-list