O
optimistx
Flanagan recommends that one should create only one global variable onto
one's page. The name of that variable should be unique for one author. The
owned domain name reversed could be the variable identification.
If one follows that practice it is possible to keep the 'global scope'
clean. (or whatever name one could use for that that area, where the
variables are sitting when I write the first javascript line?. Window,
Global object, this, initial scope, younamethatbeast). A quick test starting
with
var that = this;
for (var i in that) ...
gave a familiar list of window properties and names of one's own global
variables (names of the variables , vow! that is possible).
One could programmatically compare that list gotten in the beginning of
execution with the list gotten later and in this way find accidentally
created global variables. Netbeans IDE 6.7.1 and jslint give an early
warning about them but sometimes one wants to be very careful. Especially
when playing with 'evil' things (with the licenses from all authorities that
may concern) the checking could be useful. (eval, Function, etc).
Or is there an easier way? Any thoughts?
one's page. The name of that variable should be unique for one author. The
owned domain name reversed could be the variable identification.
If one follows that practice it is possible to keep the 'global scope'
clean. (or whatever name one could use for that that area, where the
variables are sitting when I write the first javascript line?. Window,
Global object, this, initial scope, younamethatbeast). A quick test starting
with
var that = this;
for (var i in that) ...
gave a familiar list of window properties and names of one's own global
variables (names of the variables , vow! that is possible).
One could programmatically compare that list gotten in the beginning of
execution with the list gotten later and in this way find accidentally
created global variables. Netbeans IDE 6.7.1 and jslint give an early
warning about them but sometimes one wants to be very careful. Especially
when playing with 'evil' things (with the licenses from all authorities that
may concern) the checking could be useful. (eval, Function, etc).
Or is there an easier way? Any thoughts?