I already have this:
var myVar = { appName: 'Test' };
I want to add this:
myVar = {
exec: function()
{
console.log('do stuff');
}
}
And have this:
myVar = {
appName: 'Test',
exec: function()
{
console.log('do stuff');
}
}
Actually, I want to be able to access myVar.appName and myVar.exec();
So, I can:
myVar.exec = function(){};
But if I have many more functions and variables.
Do I have to keep doing this:
myVar.func1 = function(){ // stuff 1 };
myVar.func2 = function(){ // stuff 2 };
myVar.func3 = function(){ // stuff 3 };
Are there a better way?