Test JS vs Go Live JS

One of the Express projects has the following JS supplied with a note saying:

// THIS ARRAY SET UP IS FOR CODE READABILITIES AND TESTING!
// THIS IS NOT WHAT IT WOULD LOOK LIKE TO GO LIVE

data.forEach(function(ele) {
  console.log(ele);//can I use typeScript please?!
  var thread = ['<div class="thread">'];
  thread.push('<div class="main">')
  thread.push('<p class="id">id: '+ele._id+' ('+ele.created_on+')</p>');
  thread.push('<form id="reportThread"><input type="hidden" name="report_id" value="'+ele._id+'"><input type="submit" value="Report"></form>');
  thread.push('<form id="deleteThread"><input type="hidden" value="'+ele._id+'" name="thread_id" required=""><input type="text" placeholder="password" name="delete_password" required=""><input type="submit" value="Delete"></form>');
  thread.push('<h3>'+ele.text+'</h3>');
 ...continues for 20 more rows
});

My question is how would this be done for GO LIVE?
Would you somehow reference a variable that has the html and push the variable to the array?