javascript - Using "this" in a function in Node.js -
i'm trying access this
in function, it's undefined.
function processeachpath(element, index, list) { logger.debug(this); }
...
_.each(config, processeachpath);
you need explicitly bind function:
function processeachpath(element, index, list) { logger.debug(_this); } // ... (processeachpath.bind(this))();
Comments
Post a Comment