Recently, I stumbled upon this http://www.w3schools.com/js/js_scope.asp page which introduced me to the concept of "Automatic Global variables". Here is an example of how it works:
// You can use carName variable here
function myFunction() {
carName = "Volvo";
// You can also use carName variable here
}
However, I have concerns about its scope. If it's truly global, could other files or controllers (such as those in AngularJS) access it? How far does its reach extend?