Skip to content

Instantly share code, notes, and snippets.

@Cfeusier
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save Cfeusier/22a5d22ff986d7d9aad2 to your computer and use it in GitHub Desktop.

Select an option

Save Cfeusier/22a5d22ff986d7d9aad2 to your computer and use it in GitHub Desktop.
Example of the Prototypal 'Class' Pattern in JavaScript
var Example = function() {
var example = Object.create(exampleMethods);
example.extraProp1 = "Example Property Value";
return example;
};
var exampleMethods = {
exampleGet: function() {
return this.extraProp1;
},
exampleSet: function(value) {
this.extraProp1 = value;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment