Je découvre le monde bizarre de node.js, de sa logique « asynchrone » et de la portée des variables et fonctions.
Node.js – How to Write a For Loop With Callbacks | Richard Rodger (Technology)
▻http://tech.richardrodger.com/2011/04/21/node-js-–-how-to-write-a-for-loop-with-callbacks
Voila comment on fait une boucle for
repeater(i) {
if( i < length ) {
asyncwork( function(){
repeater( i + 1 )
})
}
}
repeater(0)