Remove a word from a string

后端 未结 2 486
半阙折子戏
半阙折子戏 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:21

    yes, you can, using .replace() method

    0 讨论(0)
  • 2021-01-24 09:39
    var str = "particular #keyword";
    str.replace("keyword", "new");
    alert(str); //-> "particular #new"
    
    0 讨论(0)
提交回复
热议问题