📌  相关文章
📜  javascript 用变量替换所有内容 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:16.798000             🧑  作者: Mango

代码示例6
/**
*A better method for replacing strings is as follows:
**/
function replaceString(oldString, newString, fullString) {
  return fullS.split(oldS).join(newS)
}
replaceString('World', 'Web', 'Brave New World')//'Brave New Web'
replaceString('World', 'Web', 'World New World')//'Web New Web'