This morning when I want to write code for my plugins I have run into this problem:—>How to replace a word in a string with another word using Javascript. Even though I end up not using that javascript method but I would like to show you how to do it as well in this article. Suppose we have a string ‘Hello World’ and we would like to replace the word ‘World’ with ‘Dude’. Then using Javascript replace method we can easily do that. Follow the code below to get the job done.
var greet = "Hello World";
greet.replace("World","Dude");
Really simple!
