Created
February 25, 2015 16:22
-
-
Save RickEyre/e9165bc4c16ac8c1c1f3 to your computer and use it in GitHub Desktop.
Example of prototype JS
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 Foo() {} | |
Foo.prototype.myState = {}; | |
Foo.prototype.myBehaviour = function() { | |
console.log('Doing something'); | |
} | |
foo = new Foo(); | |
console.log(foo.state); | |
foo.myBehaviour(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment