title: How to set properties of an object dynamically in JavaScript
body: <p>SO I have a JS object that looks something like..</p>
  
  <pre><code>var Monitor=function(parent,params={}){
      this.parent=null;
      this.canvas=null;
      this.width=600;
      this.height=400;
      this.backColor="#252525";
      this.lineColor="#0171a7";
      this.lineWidth=4;
      this.radius=3;
  
      /* 2017-12-31 **********************************
      Innitialize the monitor class
      ***********************************************/
      this.init=function(parent,params){
          var that=this;
          this.parent=parent;
  
          //Loop through params and set them.
          $.each(params,function(i,val){
              eval("that."+i+"="+val);
          })
          return this;
      };
  
      this.init(parent,params);
  }
  </code></pre>
  
  <p>and call it with...</p>
  
  <pre><code>mc=new Monitor(
      $("#monitors"),
      {
          "width":800;
          "height":600,
      }
  );
  </code></pre>
  
  <p>I want to set the properties dynamically in a loop. </p>
  
  <p>However, to get it to work, I have to use eval (Eval is evil... right?).
  So it there a better way to set properties dynamically?</p>