Reputation: 10865
given i have the following block of code
(function(){
var mb = {
abc:function(){
//do something
},
xyz:function(width, height, site){
//do something
}
};
})();
how do i make the method mb.abc
accessible from the page, but not mb.xyz
?
Upvotes: 1
Views: 215
Reputation: 39019
var mb = function() {
function xyz(width, height, site){
// not visible outside
}
return {
abc:function(){
//do something
}
};
}();
mb.abc() is public, but mb.xyz() is not.
Upvotes: 5