node.js - Javascript (node) error: Unexpected token function -


i trying learn younode workshop, make modular step precise. wrote code in link , getting "error in title". have checked brackets , parenthesis can not seem find got wrong. appreciated (i started node). code , can find @ 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; } 

your problem declaring function inside of function declaration.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -