Created
July 18, 2014 13:26
-
-
Save CharlotteGore/fa9e6979eb55ab42f300 to your computer and use it in GitHub Desktop.
More basic Javascript
This file contains 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
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