Created
September 3, 2012 16:11
-
-
Save vinothbabu/3610375 to your computer and use it in GitHub Desktop.
call a private function from a string in javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var valdiate = (function() { | |
var _p={};//toss all private members into a single object. | |
_p.list=[]; | |
_p.init=function(){ | |
_p.list=[]; | |
}; | |
var noDigits = function() { | |
}; | |
//public members. use "this" to reference object followed by the method. | |
//however valdiate._p.list won't be accessible to the global scope | |
return { | |
check: function() { | |
noDigits(); | |
}, | |
fnNaMe1:function(){ | |
_p.init(); | |
}, | |
fnName2:function(){ | |
return _p.list.slice(0);//return a clone | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment