AlgorithmsCodilityPatternsTutorials

This one is short and easy, but a very useful pattern when you get the hang of it. The builder pattern allows us to create objects by dynamically adding properties to it, abstracting the true process from us.

jQuery DOM element creation is one such pattern, as it allows us define the DOM object type, and later on add some properties to it, modify it, and build it piece by piece. Lets see how it works:

 

It is clear here that you can always add new parts to your object just by calling a method on it, resulting in a cleaner interface and a easy to work with api.