title: JS: using eval on a function while trying to pass an array as parameter, but it throws an error
body: <p>i want to create a dynamic generated form using javascript, everything works fine, until i try to pass an array as parameter. When i do this, an error happens. Coulr anyone explain what this is?  </p>
  
  <p>Heres my code:</p>
  
  <pre><code>var loadFrm = function(component) {
      for(nItem in component) {
          var myComponent = "add" + firstToUpper(component[nItem].type);
      var callComponent = myComponent + "(" + component[nItem].opt + ");";
      eval(callComponent);
      }
  }
  
  var json = [
      {
          type: "scale",
          opt: {content: [{label: "male", value: "m"}, {label: "female", value: "f"}]}
      }
  ];
  
  loadFrm(json);
  </code></pre>
  
  <p><strong>Edit</strong> Here's the error:  </p>
  
  <pre><code>missing ] after element list
  [Break on this error] addScale([object Object]);
  </code></pre>