replace innerhtml javascript by regex 1

replace innerhtml javascript by regex

var source_string = “The is a JavaScript tutorial”;
 
var rep_string = source_string.replace(“JavaScript”,”JS”);

Here is what the above code is Doing:
1. We have a string variable called source_string.
2. We use the replace() method to replace the word “JavaScript” with “JS”.
3. We store the result in a new variable called rep_string.
4. We print the value of rep_string.

Similar Posts