Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

javascript - node.js全局变量?(node.js global variables?)

I asked here: node.js require inheritance?(我在这里问: node.js是否需要继承?)

and was told that I can set variables to the global scope by leaving out the var.(有人告诉我可以通过省略var将变量设置为全局范围。) This does not work for me.(这对我不起作用。) ie:(即:) _ = require('underscore'); Does not make the _ available on required files.(不能使_在必需文件上可用。) I can set with express's app.set and have it available elsewhere though.(我可以使用express的app.set进行设置,但是可以在其他地方使用。) Can somebody confirm that this is supposed to work?(有人可以确认这应该起作用吗?) Thanks.(谢谢。)   ask by Harry translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...