JSFiddle - React, Tailwind, and code Playground
HTML
<span id="console"/>
JavaScript
String.prototype.log = function() {
var args = Array.prototype.slice.call(arguments);
var rep= args.slice(0, args.length);
var i=0;
var output = this.replace(/%s|%d|%f|%@/g, function(match,idx) {
var subst=rep.slice(i, ++i);
return( subst );
});
return output;
}
res="Hello %s how are you %s is everything %s?".log("Loreto", "today", "allright")
document.getElementById("console").innerHTML=res;