IGRACH IGRACH - 2 years ago 181
Javascript Question

Does node.js have equivalent to window object in browser

What I mean is does node.js have object that are global function methods of. Like this in browser:

function myGlobalFunction() {
console.log(this === window);

=> true

Answer Source

The closest equivalent in node is global. I'm not sure if it translates in all of the same ways, but if you open a REPL and type in this === global, it will return true.

Here's a discussion on the global object, though some it the information may be deprecated as it's pretty old: 'Global' object in node.js

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download