I'm facing issues with configuring object while inheriting So I've
baseclass.prototype.activity =function(){ console.log("Im"+activity); }
and multiple other objects inheriting the base class(say A and B).
I want to configure run based on type of A and B So if it is A then calling run should make activity as Running and similarly with B it can be swimming I'm using following factory method for creating A and B depending on their type
activityFactoryObject.prototype.makeObj = Object.create(baseclass);
activityFactoryObject.prototype.createObject = function (config) {
switch (config) {
case "running":
this.makeObj = A;
break;
case "swimming":
this.makeObj = B;
break;
}
this.makeObj.prototype = baseclass.prototype;
return new this.makeObj(config);
};