Good day everyone,
i have a question which i wasn't able to solve via google (maybe i don't know the right search term) so if my question is already answered i apologize.
I try to learn some JavaScript and read about global variables belonging to the window object on w3schools which may have led to a misunderstanding on my side.
Let's say i have two scripts:
- script1.js
- script2.js
which i load into a html-document in the head section. Both contain something like
var globy = 0;
(and/or possible manipulations of globy)
Now the question is: Does the belonging to the window-object of "globy" mean that both scripts share and manipulate the same "globy" ?
If this is not the case, another question results: is it possible to achieve such a thing like a global variable with a scope spanning multiple *.js files?
I am wondering because i was thinking about advantages and disadvantages that would bring like easy communication between scripts on the +side and easy unwanted interference on the -side.
I would appreciate correction/verification. Greetings, Wolf