How to Replace any Character or Word in Javascript?

 Posted by vishalneeraj-24503 on 12/19/2013 | Category: JavaScript Interview questions | Views: 883 | Points: 40
Answer:

With the help of Replace in-built Javascript Function,we can replace any Character or Word in Javascript.

For Example:-

function replace_word()

{
var text = "Vishal Kumar";
var result = text.replace("Kumar","Neeraj");
alert(result);
}


Here, Kumar will be replaced with Neeraj.So,the output would be Vishal Neeraj.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response