Remove a word from a string

后端 未结 2 490
半阙折子戏
半阙折子戏 2021-01-24 08:36

i want to remove a particular #keyword from a string. i dont know its position or anything. can i use javascript to do it?

2条回答
  •  孤街浪徒
    2021-01-24 09:39

    var str = "particular #keyword";
    str.replace("keyword", "new");
    alert(str); //-> "particular #new"
    

提交回复
热议问题