Skip to content

Instantly share code, notes, and snippets.

@haoch
Created June 7, 2013 06:19
Show Gist options
  • Save haoch/5727373 to your computer and use it in GitHub Desktop.
Save haoch/5727373 to your computer and use it in GitHub Desktop.
javascript prototype class
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