JSFiddle - React, Tailwind, and code Playground

by jlss

JavaScript

String.prototype.f	 = function () {
  var args = arguments;
  return this.replace(/\{(\d+)\}/g, function (m, n) { return args[n]; });
};
alert("a cookie {0} a book {0}{1}".f("or","end"))