Skip to content

Instantly share code, notes, and snippets.



Created Dec 30, 2014
What would you like to do?
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment