Brams wrote:
> Ok, so it seems i should be heading towards the namespace direction.
> [ ... ]
> var MYAPP = MYAPP || {}
>
> MYAPP.myArray = //my array
>
> THen every time i need that array i would simply:
> MYAPP.myarray
>
> is that correct?
Yes, that should work.
Of course to take the namespace further, you should make sure
everything that you otherwise add to the global scope from your code
goes into the same namespace. This way, you've introduced only one
variable to the global scope, and are much less likely to run into
conflicts with other code you might choose to use. (The same way that
all of jQuery's functions are found only in the jQuery namespace or
its "$" alias.)
-- Scott
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]