Created
July 18, 2015 11:57
-
-
Save Winwardo/c9494b3253553ababdae to your computer and use it in GitHub Desktop.
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 StudentClass = function(){ | |
this.name = "Some default name"; | |
this.age = undefined; | |
this.address = {}; | |
}; | |
var StudentClassBuilder = new BuilderDecorator(StudentClass); | |
var student = new StudentClassBuilder() | |
.name("John") | |
.age(17) | |
.address({postcode: "90210"}) | |
.build(); | |
student.name(); // "John" | |
student.age(); // 17 | |
student.address(); // {postcode: "90210"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment