I could create an object with some methods, and later add a property to it as follows:
var myObj = (function () {
var my = {};
my.method1=function(){}
my.method2=function(){}
my.method3=function(){}
return my;
}());
myObj.myProperty=123;
How could I create the object first and add a property, and then later add the methods afterwards?
myObj={};
myObj.myProperty=123;
//How do I add the above methods to myObj?
myObj.my = { method1: function() }myObj.method1 = function() {}?myObj.method1=function(){};because you want the functions to be defined in their own scope? Otherwise I don't really see what the issue is.