No "var" before "text ="? Declaring "text"


There is no "var" before "text" when this string is first used. Can someone explain why?

text = "Blah blah blah blah blah blah Eric \
blah blah blah Eric blah blah Eric blah blah \
blah blah blah blah blah Eric";


It doesn't matter since this variable is in global scope. var is a scoping tool.


Thank you!, very minimalist compared to C/C++, Java, etc...


A late supplement...

We need to respect the global scope, so much so that we protect it. That is why functions are so invaluable. Not only do we protect our own variables, we also protect the global namespace from being populated with garbage that is never collected and variables that could possibly collide with other programs present in the same namespace (plug-ins and libraries and other script). With everything populating the same space, collisions will happen. It's up to us to prevent that. Protect the global scope.