Suppose the string:
"The | dog";
If I do in js:
var string;
string = "The | dog | and | apple";
string.split("|")[1];
The returns will be "dog". I should like to replace that, somelike this:
string.split("|")[1] = "cat";
And the string pass to be "The | cat | and |apple", knowing as string "dog" can be another value too.
It's possible?
replace()though..replace('dog', 'cat')?.replacedoes not replace all instances. It only replaces the first instance. You can use.replaceAll