JSFiddle - React, Tailwind, and code Playground

by smartdev101

HTML

<script src="https://raw.github.com/janl/mustache.js/master/mustache.js"></script>
<div id="answers"></div>

JavaScript

var template = "multi: {{#answerVOs}}{{answer}}; {{/answerVOs}}";
//need => multi: option1; option2; option3   (no semicolon at the end)

var json = {
    "answerVOs": [ 
      { "answer" : "option 1"
      },
      { "answer" : "option 2"
      },
      { "answer" : "option 3"
      }
    ]
};

document.getElementById("answers").innerHTML = Mustache.to_html(template, json);