It is not so comfortable to use JavaScript to implement namespaces. Javascript only has function scopes, and all parts of it are considered as a namespace, sometimes errors caused by duplicate names are confusing, and it is difficult to debug and solve problems that students who have used Java and C # are very familiar with namespaces, in a complex system, there will be N more functions, objects, languages, pre-defined architectures, and so many functions and objects. Due to the requirements of programming specifications, there are actually meaningful names, it is inevitable that duplicate names will be called incorrectly, but with namespace troubles, they will not only be able to classify organizational functions and objects, but also form isolation to solve the problem of duplicate names.
JavaScript is not so comfortable. Javascript only has a function scope. What block of files are considered as a namespace? Sometimes, errors caused by duplicate names are puzzling, difficult to debug.
A simple example
The Code is as follows: