📜  创建函数替换所有 n javescript - Javascript 代码示例

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

代码示例3
/**
*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'