title: JavaScript append HTML in for-loop
body: <p>in the following snippet I have a for-loop and want to append the HTML Code in each Iteration to use the list inside my ul-Tag.
  If I replace the += with the = operator it works, but only for the last element obviously.
  How can I append it correctly in the loop?</p>
  <pre><code>    var text = &quot;the Text&quot;
      var list
      for (var i = 1; i &lt; split_respone.length; i+=2) {
        list += &lt;li className=&quot;link-list-item&quot;&gt;
              &lt;a
              href={split_respone[i]}
              target=&quot;_blank&quot;
              rel=&quot;noopener noreferrer&quot;
              className=&quot;link-list-item-url&quot;&gt;
              {split_respone[i+1]}&lt;/a&gt;
              &lt;/li&gt;
      }
      string = &lt;ul className=&quot;link-list&quot;&gt;{text}{list}&lt;/ul&gt;;
    } 
    const message = self.createChatBotMessage(string);
  });
  }
  </code></pre>