On the browser I can use the window object. How to do this on node.js?
var name="test";
var <name> = 3;
print(test);
//output: 3
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I can’t do this in node in any local scope, but you can do this in global scope (like in browser window object):
So,
globalobject exactly the same as browserwindowobject.Difference is: in browser when you declaring
var test = 2in top-level scope you actually creatingwindow['test'], but in node you don’t, because every module scoped with function call by default.