Skip to content

Instantly share code, notes, and snippets.

@lotz84
Created January 19, 2015 09:56
Show Gist options
  • Save lotz84/93c4d7caef9841cc25d3 to your computer and use it in GitHub Desktop.
Save lotz84/93c4d7caef9841cc25d3 to your computer and use it in GitHub Desktop.
var contEach = function(arr,f) {
if (arr.length == 0) {return;}
var next = function(){contEach(arr.splice(1),f);}
f(arr[0], next);
}
// Example
contEach(queries, function(query, next){
$.get("https://www.google.co.jp/search?q="+query,function(body){
// some process with body
next();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment