search

Home  >  Q&A  >  body text

About this in nodejs - Stack Overflow

I understand the truth. I just want to know how the following code runs in the nodejs environment

var varFunc = function declareFunc() {
    console.log(this);
    console.log(global);
    console.log(global.declareFunc);
    console.log(declareFunc);
}
console.log(this)
varFunc();

Why does console come out in the end of this code [Function: declareFunc]?

我想大声告诉你我想大声告诉你2747 days ago776

reply all(2)I'll reply

  • 漂亮男人

    漂亮男人2017-07-05 10:38:05

    The last information printed is console.log(declareFunc);This sentence

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-07-05 10:38:05

    Let’s take a look at this article:
    Some little tricks in Nodejs - QueenKing - SegmentFault /a/11...

    reply
    0
  • Cancelreply