Is javascript supports namespace?

Posted by Jennifer | Updated on

JavaScript doesn’t support namespace by default. So if you create any element(function, method, object, variable) then it becomes global and pollutes the global namespace. Let’s take an example of defining two functions without any namespace,

It always calls the second function definition. In this case, namespace will solve the name collision problem.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers