Skip to content

Instantly share code, notes, and snippets.

@bitbrain
Created September 28, 2013 19:00
Show Gist options
  • Save bitbrain/6745271 to your computer and use it in GitHub Desktop.
Save bitbrain/6745271 to your computer and use it in GitHub Desktop.
Javascript attributes
var myClass = function() {
this.attribut1 = "Heisenberg";
this.attribut2 = "Heisenberg";
getAttribut1 : function() {
return this.attribut1;
}
}
var element = new myClass();
alert(element.getAttribut1()); // should output attribut1
// Appending something via prototype
element.prototype.newattribute = "This should be a new attribute";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment