title: Looping inside JavaScript parameter
body: <p>Using <a href="http://www.highcharts.com/" rel="nofollow noreferrer">Highchart</a> plugin, I tried to <a href="https://stackoverflow.com/q/34455783/3377130">generate a pie chart from table</a> data. But it is not working, as table values are wrapped with <code>&lt;a&gt;</code> tags. Probably next easiest solution can be storing table values into an <code>array</code>. Then use that data-array to generate pie charts. As number of table rows, cells, values, etc. may alter, so I am finding a dynamic solution that will turn that <code>array</code> into parameter-value pair. Something like <a href="https://jsfiddle.net/armikbd/2vdvur9L/" rel="nofollow noreferrer">following</a>,</p>
  <pre><code>data: [{
      name: 'Point 1',
      color: '#00FF00',
      y: 1
  }, {
      name: 'Point 2',
      color: '#FF00FF',
      y: 5
  }]
  </code></pre>
  <p>So, actually I am trying to use loops for <code>name</code>, <code>color</code>, <code>y</code> etc.</p>
  <hr />
  <h3>Edit: More clarification</h3>
  <p>I am looking for functions something like below.</p>
  <pre><code>var names = ['Point 1', 'Point 2'];
  var colors = ['#00FF00', '#FF00FF'];
  var y =[1 , 2]
  
  function tableData(){
      for (i=0; i&lt;=1; i++ ) {
          name: names[i],
          color: colors[i],
          y: y[i]
      }
  }
  
  data: [tableData()]
  </code></pre>