The callback you provide to entry.file()
is asynchronous, so it returns for each file after the console.log(file)
.
If you drop in a console.log(files)
on line 25, you can see it getting updated as each callback is fired. So if you want to do something with all the files, you'll need to wait for every callback to execute.
Here's a simple example of waiting until all the files have returned: http://jsfiddle.net/6Tn8W/.
I would also recommend checking out promises.
EDIT: Here's an example using promises and the when() function. This is the first time I've used jQuery's implementation of promises, so there might be a better way to do this :)