What does “this” mean in a nodejs module?

后端 未结 1 422
感动是毒
感动是毒 2020-12-04 01:00

I have a simple codes like the following and execute it as a node module:

console.log(this);
module.exports = {…};

I know that global

相关标签:
1条回答
  • 2020-12-04 01:35

    this (in the context of a module) is the same as exports in node.js. However you should generally use exports/module.exports instead, so that it's explicitly clear what you're modifying.

    0 讨论(0)
提交回复
热议问题