title: "missing ] after element list" with eval
body: <p>im trying to pass two parameters to a function, "i" being an int value and "map" being an object. I'm using eval to inform Javascript that I am passing objects, however im getting the error "missing ] after element list".</p>
  
  <p>I'm kinda new to this so I'm not 100% sure if this is the right way of doing things... but ya.. hopefully i'm on the right track.</p>
  
  <pre><code>...
  
  optionsControlDiv.innerHTML += '&lt;input type="checkbox" onclick="toggleLayer('+eval(i)+","+eval(map)+')"'+c+' /&gt;'+this.opts[i]+'&lt;br&gt;';
  console.log('&lt;input type="checkbox" onclick="toggleLayer('+eval(i)+","+eval(map)+')"'+c+' /&gt;'+this.opts[i]+'&lt;br&gt;');
  // OUTPUT: 
      // &lt;input type="checkbox" onclick="toggleLayer(0,[object Object])" /&gt;Wiki&lt;br&gt;
      // &lt;input type="checkbox" onclick="toggleLayer(1,[object Object])" /&gt;webcams&lt;br&gt;
      // &lt;input type="checkbox" onclick="toggleLayer(2,[object Object])" /&gt;Photos&lt;br&gt;
  
  // ERROR:   
      // missing ] after element list
      // [Break on this error] toggleLayer(0,[object Object])
  
  ...
  
  // The function
  function toggleLayer(i,map) {
      //console.log(i);
      if (layers[i].Visible) {
          layers[i].hide();
      } else {
          if(layers[i].Added) {
              layers[i].show();
          } else {
              map.addOverlay(layers[i]);
              layers[i].Added = true;
          }
      }
      layers[i].Visible = !layers[i].Visible;
  }
  </code></pre>