Skip to content

Instantly share code, notes, and snippets.

@CharlotteGore
Created July 18, 2014 13:26
Show Gist options
  • Save CharlotteGore/fa9e6979eb55ab42f300 to your computer and use it in GitHub Desktop.
Save CharlotteGore/fa9e6979eb55ab42f300 to your computer and use it in GitHub Desktop.
More basic Javascript
function Tiger (){
this.name = "";
this.isKing = false;
// you can define the methods this way...
this.setName = function (name){
this.name = name;
};
this.getName = function (){
if (this.isKing){
return this.name + ", who is the mother fucking king!"
} else {
return this.name + ", who is a nobody"
}
};
this.coronate = function (){
this.isKing = true;
}
return this;
}
var tigerKing = new Tiger();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment