Why console.log(this) prints an empty object when used in the global context? Shouldn't it point to the global object?

This page summarizes the projects mentioned and recommended in the original post on /r/learnjavascript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • node

    Node.js JavaScript runtime ✨🐢🚀✨

  • ...or something similar to that. I mean, it's pretty close to that. You can see for yourself if you want. These lines there are exactly what they do: They set thisValueto point to module.exports and then they execute your file/module with that as the value of this. (Only they have some additional helper stuff like ReflectApply because there are some additional complexities now with modules. In the older versions of the code you could see the apply call directly there.

  • node-v0.x-archive

    Discontinued Moved to https://github.com/nodejs/node

  • ...or something similar to that. I mean, it's pretty close to that. You can see for yourself if you want. These lines there are exactly what they do: They set thisValueto point to module.exports and then they execute your file/module with that as the value of this. (Only they have some additional helper stuff like ReflectApply because there are some additional complexities now with modules. In the older versions of the code you could see the apply call directly there.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts