Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created December 30, 2014 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanhoff/495fe2b90ae4ececba36 to your computer and use it in GitHub Desktop.
Save alanhoff/495fe2b90ae4ececba36 to your computer and use it in GitHub Desktop.
Array assíncrona
var arr = [1, 2, 3, 4];
(function it(i){
if(arr[i] === undefined)
return console.log('Acabou!');
console.log('Estou no elemento', arr[i]);
// Quando estiver pronto chama o it de novo
setTimeout(it.bind(null, ++i), 1000);
})(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment