Created
June 7, 2013 06:19
-
-
Save haoch/5727373 to your computer and use it in GitHub Desktop.
javascript prototype class
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 constructor_func = function(){ | |
// codes | |
} | |
var class_name = function(){ | |
this.attr=null; // instance variable | |
this.attr2=null; // instance variable | |
} | |
class_name.prototype = { | |
constructor:constructor_func, | |
//more functions | |
} | |
// usage | |
new class_name() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment