Tuesday, May 28, 2013

Closures...

I'm sorry for the long lack of updates. Recently I've been very busy. I travelled a lot and I had a lot of work to do, so not really much time to work on my project and discover new interesting things. Today I want to post something that bothered me for a while. I was calling an asynchronous function, m_cli.get(), inside a for loop and wanted to keep the index variable as it was going to be used in the callback. The first approach was the following, and of course was not working: for(var i = 0; i < list.length; i++){ mc_cli.get(list[i],...