I'm trying to convert a regular function into function with namespacing. This is the regular function:
surprise();
function surprise() {
alert('TEST');
}
and this is the same function with namespacing:
var namespace = {};
namespace.surprise();
namespace.surprise = function () {
alert('TEST');
};
I get the following error: Uncaught TypeError: namespace.surprise is not a function