S
S
sergealmazov2016-01-21 11:02:33
JavaScript
sergealmazov, 2016-01-21 11:02:33

How to access a variable through a global object in Node?

In the browser, we can write like this:
var a = 5;
console.log(window.a); //5
And in Node.JS?
And in Node.JS on a C9.io server?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
yeti357, 2016-01-21
@yeti357

You need a GLOBAL object. Like GLOBAL.a=5;, but that's bad practice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question