JSFiddle - React, Tailwind, and code Playground

JavaScript

var Panel = function(obj) {
  this.maxWidth = function(max_width) {
    //document.getElementById(obj["id"]).style.maxWidth = max_width;
    console.log('hi');
  }
  for (var prop in obj) {
    if (typeof this[prop] === 'function') {
      this[prop](obj[prop]); // call this method with right argument
    }
  }
}


var myObj = {
  "maxWidth": "400px"
}

var p = new Panel(myObj);