Answers for "javascript iterator callback"

0

javascript iterator callback

//use let keywork and i will increment correctly inside loops
for (let i = 0; i < a.length; i++) {
   makeHttpReqest("http://www.codegrepper.com", function(response) {
       // i will increment correctly here; 
 
  });
}

//Alternatively, if you can't use let, this syntax will work too
for (var i = 0; i < a.length; i++) (function(i)
{
   makeHttpReqest("http://www.codegrepper.com", function(response) {
       // i will increment correctly here; 
 
  });
}) (i);
Posted by: Guest on July-22-2019

Code answers related to "javascript iterator callback"

Code answers related to "Javascript"

Browse Popular Code Answers by Language