#1
ExampleString = 'the dog looks like a dog';
ConvertString = ExampleString.replace(/dog/g, 'cat');
#2
ExampleString = 'the dog looks like a dog';
ExampleString.split("dog").join("cat");
#3
ExampleString = 'the dog looks like a dog';
while(ExampleString.includes("dog")){
ExampleString = ExampleString.replace("dog", "cat");
}
Comments
Post a Comment