Now you can access your functions the same way you access any other object property. In this case, the functions are referred to as “methods”.

console.log(nameSpace.myFunc(1,2));// returns 3

Another advantage you have of declaring functions in an object literal is
gaining access to the this variable within each method. In the example
above, this refers to nameSpace object. It can be referred to easily in this manner without declaring any functions in the global namespace. Handy indeed.