r/coffeescript • u/themeteorchef • Jul 19 '14
Easy way to do global variables?
Confused on how to do this in a way that doesn't take a lot of bending over backwards. Best practice?
2
Upvotes
r/coffeescript • u/themeteorchef • Jul 19 '14
Confused on how to do this in a way that doesn't take a lot of bending over backwards. Best practice?
3
u/brotherwayne Jul 19 '14
Frankly the best practice is not to do it. If you need configuration use defaults or a configuration file.
3
u/Corkscreewe Jul 19 '14
(window || global)['myvar'] = "please don't do this. global variables are a really bad practice."
1
u/killercup Jul 19 '14
window.myVar = 42in the browser, don't do it in node (use modules).1
u/[deleted] Jul 19 '14
Best practice is not to use them.
-2
u/[deleted] Jul 19 '14
.