For me variables are easy to understand in Javascript: if a variable is not in local scope then it is a field in the global object.
But what about Javascript commands? If i just write Javascript commands in a file (outside any function) then how will the Javascript engine interpret it?
----- file.js -----
console.log('hai:DDD');
--- end of file ---
Will it create some kind of "global" or "main" function
type object with the commands and then execute it? What if there are multiple files with code?
I guess this question only applies to node.js because in browsers all Javascript code is event handlers