function (str) {
  const args = arguments
  let flag = true
  let i = 1

  str = str.replace(/%s/g, () => {
    const arg = args[i++]

    if (typeof arg === 'undefined') {
      flag = false
      return ''
    }
    return arg
  })
  return flag ? str : ''
}
function (str) {
  const args = arguments
  let flag = true
  let i = 1

  str = str.replace(/%s/g, () => {
    const arg = args[i++]

    if (typeof arg === 'undefined') {
      flag = false
      return ''
    }
    return arg
  })
  return flag ? str : ''
}
function ( str ) { const args = arguments let flag = true let i = 1 str = str . replace ( / %s / g , ( ) => { const arg = args [ i ++ ] if ( typeof arg === 'undefined' ) { flag = false return '' } return arg } ) return flag ? str : '' }
it only does '%s', and return '' when arguments are undefined
it only does %s and return when arguments are undefined