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 , 徐
参考文章
评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。
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 , 徐
参考文章
本文由 用户 于 2024-01-11 发布在 夸智网,如有疑问,请联系我们。
本文链接:https://www.kuazhi.com/post/712877382.html
发表评论