I am trying the learn younode workshop, the make it modular step to be precise. I wrote the code in the link and am getting the "error in the title". I have checked brackets and parenthesis but can not seem to find where i got it wrong. Any help would be appreciated (i just started with node). My code is this and you can find it also at this link: http://pastebin.com/G8x2GH7h
module.exports = function (directoryPath, extention, function(error, arrayOfNames) {
var fs = require('fs');
var path = require('path');
var FileNamesArray = [];
fs.readdir(directoryPath,function (error,list){
list.forEach(function (file) {
if (path.extname(file) === '.' + extention) {
FileNamesArray.push(file);
}
});
});
return FileNamesArray;
}){
return ArrayOfNames;
}
ArrayOfNamesup to?functionyou have at(directoryPath, extention, function(error, arrayOfNames)is a syntax error.function(error, arrayOfNames) {...}is not valid where it is. It's not clear to me what you are trying to do with that.