Reputation: 9502
I'm trying to get access to this
in a function, but it's undefined.
function processEachPath(element, index, list) {
logger.debug(this);
}
...
_.each(config, processEachPath);
Upvotes: 0
Views: 42
Reputation: 14165
You need to explicitly bind it to the function:
function processEachPath(element, index, list) {
logger.debug(_this);
}
// ...
(processEachPath.bind(this))();
Upvotes: 1