JSFiddle - React, Tailwind, and code Playground
JavaScript
var MyObject = function(id, config){
this.id = id;
this.size = 10;
this.quantity = 2;
this.param = true;
if(config){
Object.assign(this, config);
}
}
var configObject = {
size: 11,
quantity: 3,
param: false
}
var invokedObject = new MyObject('123', configObject);
console.log(invokedObject);