Can anyone explain to me please that if using a namespace is a good coding practice. And why is it needed? If it was a good approach why JQuery didn’t include it by default. There is a separate plugin to allow this functionality.
I saw this post that mentions few ways to do it. Someone mentioned about memory leak in the post that is worrisome.
Lastly, what is the best way to organize JQuery libraries?
thanks,
Notes:
In response to Amir’s comment:
YUI achieves namespacing by adding a variable to the YUI object where the added variable is also an object. Their namespace function just builds it for you.
In jQuery, you add it to the
jQuery.fn(or$.fnif you use$for jQuery() namespace.