Created
May 10, 2013 08:39
-
-
Save t0dd/5553218 to your computer and use it in GitHub Desktop.
The factory pattern. a pseudo "interface" for objects in 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
//The Factory Pattern | |
var createPerson = function(firstName, lastName) { | |
return { | |
firstName : firstName, | |
lastName : lastName, | |
greet : function(){ | |
return "Hey there " + firstName + " " + lastName; | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment