Languages
[Edit]
EN

Does NodeJS have equivalent to browser window object?

12 points
Created by:
Root-ssh
6322

In NodeJS there is not equivalent of window like in browsers but there is global object that represents global scope inside module.

1. Official documentation for global object in NodeJS 

In browsers, the top-level scope is the global scope. This means that within the browser var something will define a new global variable. In Node.js this is different. The top-level scope is not the global scope; var something inside a Node.js module will be local to that module.

 

Documentation link is here.

Merged questions

  1. Global scope reference in NodeJS

  2. Global scope reference in node.js
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.