Your callback is a function expression, hence doesn't get hoisted. Write it as a function declaration or move the function expression before the readdir call.
On Wednesday, January 22, 2014 7:19:14 PM UTC+1, Liam Ryan wrote: > > Hi All, > > Probably a stupid question but I wanted to make my code for filteredLS > easier to read by doing something like - > > var fs = require("fs); > > fs.readdir(process.argv[2], callback); > > var callback = function( err, files) { > .... > } > > However this doesn't seem to work, is it my syntax or will this just not > work for node? > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.