code: function formatString(string, params) {
    return string.replace(/{(\d+)}/g, function (match, number) {
      return typeof params[number] !== undefined ? params[number] : match;
    });
  }
docs: Replaces string placeholders with corresponding template string