Create the object constructor by using a IIFE and put the secret inside that scope:
var Container = (function(){
var secret = 3;
return function(param) {
function dec(){
if (secret > 0) {
secret -= 1;
return true;
} else {
return false;
}
}
this.service = function(){
if(dec()){
return param;
} else {
return null;
}
};
};
})();