javascript iterator callback

Solutions on MaxInterview for javascript iterator callback by the best coders in the world

showing results for - "javascript iterator callback"
Claudio
31 Feb 2018
1//use let keywork and i will increment correctly inside loops
2for (let i = 0; i < a.length; i++) {
3   makeHttpReqest("http://www.codegrepper.com", function(response) {
4       // i will increment correctly here; 
5 
6  });
7}
8
9//Alternatively, if you can't use let, this syntax will work too
10for (var i = 0; i < a.length; i++) (function(i)
11{
12   makeHttpReqest("http://www.codegrepper.com", function(response) {
13       // i will increment correctly here; 
14 
15  });
16}) (i);