Skip to content

Instantly share code, notes, and snippets.

@alanhoff

alanhoff/arr.js

Created Dec 30, 2014
Embed
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);
})(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment