<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,height=device-height">
  <title>JS字符串使用占位符轻松实现拼接(来自react源码)</title>
  <style>
  </style>
</head>
<body>
  <script>
  let args = ['xu', '徐']
  let s = '%s , %s'
  let argIndex = 0
  let newString = '%s , %s'.replace(/%s/g, () => args[argIndex++])
  console.log(s) //%s , %s
  console.log(newString) //xu , 徐
  </script>
</body>
</html>
                










