JSFiddle - React, Tailwind, and code Playground
HTML
<div id="abc"></div>
JavaScript
$(document).ready(function() {
$("#abc").html(format("foo {0} {1}", "'!{zero'", "'one'"));
});
function format (fmtstr) {
var args = Array.prototype.slice.call(arguments, 1);
return fmtstr.replace(/\{(\d+)\}/g, function (match, index) {
return args[index];
});
}