What are the benefits of using namespaces in javascript?

Besides not cluttering up the global namespace and getting the ability to encapsulate code in private members, is there any use?

0
source share
3 answers

Yes you are right. Besides the benefits of namespaces, there are no advantages to namespaces.

But be sure to think about what happens if you add additional external scripts later or make your own scripts more complex. Namespaces are pretty lightweight and easy to set up, and never harm from the start.

+1
source

. , .

( , - -), . , .

+2

, , , Namespace . , , 10 .js . , "delete" 10 , 10 ( ) "" .

0

Source: https://habr.com/ru/post/1628604/


All Articles