calling a function having callback in for loop
I want to run window.resolveLocalFileSystemURI(file,success,fail) in for loop passing different file entries and want to return resolved entries in array only after I get all the entries. function resolveFiles(result,callback) { var resultData=[] window.resolveLocalFileSystemURI(result, function(entry) { resolvedGalleryImages.push(entry); callback(resolvedGalleryImages); resolvedGalleryImages=[]; }, function(e) { alert("err"+e);}); } //calling-- //@filesarr has captured images uris for(i = 0; i < filesarr.length; i++) { resolveFiles(filesarr[i],function(result){ var resultArr = result; }); }