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);
You need to explicitly bind it to the function:
function processEachPath(element, index, list) {
logger.debug(_this);
}
// ...
(processEachPath.bind(this))();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.