title: Uncaught SyntaxError: Unexpected token for
body: <p>I am trying to produce the following HTML dynamically:                </p>
  
  <pre><code>&lt;ul&gt;
     &lt;li&gt;Butter Extra&lt;/li&gt;
     &lt;li&gt;Butter Extra&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I was trying it this way:</p>
  
  <pre><code>var toppingval = 'Butter Extra,Butter Extra';
  
  if (toppingval.indexOf(",") &gt; 0)
  {
      var array = toppingval.split(',');
      var uitaghtml = '&lt;ul&gt;' +
      for (var z = 0; z &lt; array.length; z++) 
      {
          '&lt;li&gt;' + array[z] + '&lt;/li&gt;' +
      }
      '&lt;/ul&gt;';
  }
  </code></pre>
  
  <p>But when I tried this it throws an exception in console as </p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token for  
  </code></pre>
  
  <p>Could anybody please let me know how to solve this?</p>