Created
December 18, 2016 20:40
-
-
Save aramkoukia/a3f849856ce664b32a304c8654599739 to your computer and use it in GitHub Desktop.
object-factories creating objects and assign behaviors sample
This file contains hidden or 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
var person = function (name, age) { | |
var state = { | |
name: name, | |
age: age, | |
words: 'Hello' | |
}; | |
return Object.assign( // Merge our 'behavior objects | |
{}, | |
speaker(state), | |
walker(state) | |
); | |
}; | |
var owl = function (name, color) { | |
var state = { | |
name: name, | |
color: color | |
}; | |
return Object.assign( | |
{}, | |
walker(state) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment