function subs(pattern, subs) {
  const splitParts = pattern.split('%s');
  let returnString = '';

  // Replace up to the last split part. We are inserting in the
  // positions between split parts.
  const subLast = splitParts.length - 1;
  for (let i = 0; i < subLast; i++) {
    // keep unsupplied as '%s'
    const sub = (i < subs.length) ? subs[i] : '%s';
    returnString += splitParts[i] + sub;
  }
  return returnString + splitParts[subLast];
}
Does simple python-style string substitution.
subs("foo%s hot%s", "bar", "dog") becomes "foobar hotdog".
@param {string} pattern The string containing the pattern.
@param {!Array<*>} subs The items to substitute into the pattern.
@return {string} A copy of `str` in which each occurrence of
    `%s` has been replaced an argument from `var_args`.