I'm creating a namespace and are wondering how I can restrict accessibility to a namespace variable so that it only can be accessed from inside the namespace.
In my sample code I want PrivateExec to be private
and not accessible outside the namespace.
var demo = {
a: "demo",
b: {
PrivateExec: function () {
//execute
},
ExecA: function () {
PrivateExec();
},
ExecB: function () {
PrivateExec();
}
}
}
demo.ExecA(); //success
demo.PrivateExec(); //fails because of private