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);