Last active
August 29, 2015 14:02
-
-
Save JohnArcher/8502356fb3c8aa7779e5 to your computer and use it in GitHub Desktop.
JavaScript-Class-Template with public and private members and functions
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
| function MyClass() { | |
| // private member | |
| var that = this; | |
| // public members | |
| this.publicMember = 'Bazinga'; | |
| // private functions | |
| var privateFunction = function() { | |
| }; | |
| // public functions | |
| this.publicFunction1 = function() { | |
| var privateFunctionResult = privateFunction(); | |
| }; | |
| this.publicFunction2 = function() { | |
| var publicFunction1Result = that.publicFunction2(); | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment