Posts

Showing posts from April, 2017

Abstract Factory

Definition: Provide the interface for creating families of related or dependent objects without specifying their concrete classes. For eg: function Employee (name){       this.name = name;    this.say = function (){                  log.add("I am employee "+ name);    }; } function EmployeeFactory(){     this.create  = function(name){         return new Employee(name);     }; } var log = (function (){   var log = "";          return {              add: function (msg){ log += msg+ "\n"}              show : function (){console.log(log); log = ""}    } })(); function run(){   ...

JavaScript Split

Hi Folks, Split in javascript eg: var str = "hi good morning"; var res = str.split(" ");