I am trying to do something like
(function( skillet, $, undefined ) {
skillet.global = {
names: {
first: 'abe',
last: 'watson'
},
addresses: {
home: 'blah'
}
}
}( window.skillet = window.skillet || {}, jQuery ));
So that I can access like
skillet.global.names.first();
skillet.global.address.home();
But I keep getting errors ? How can I go about fixing this
You are calling
firstandhomeas if they were functions; yet you have defined them as object properties.Calling
skillet.global.names.firstwould (if in an alert) showabe, if you need to define them in functions, you need to use the correct function declaration, i.e.