The Problem of nodejs that Anonymous function Can’t Understand

  node.js, question

exports.getAllAlbums = function(callback){

fs.readdir("./upload", function(err,files){
 var allAlbums = [];
 (function iterator(i){
 if(i == files.length){
 callback(allAlbums);
 return;
 bracket
 Stat ("./upload/"plus files[i],function(err,stats){
 if(stats.isDirectory()){
 allAlbums.push(files[i])
 bracket
 Iterator(i plus 1)
 })
 })(0);
 
 })

bracket

Today, this function got stuck inexplicably. What is the meaning of (0) in the last bracket? Please tell me more about the running sequence. The following is the call

file.getAllAlbums(function(allAlbums){

res.render("index",{
 "albums" : allAlbums
 });
 })

The parameters of the function are executed immediately.
exactly
function iterator(i){
// …
bracket
iterator(0);