var variableABC = \"A B C\"; variableABC.replace(\'B\', \'D\') //wanted output: \'A D C\'
but \'variableABC\' didn\'t change :
Isn't string.replace returning a value, rather than modifying the source string?
So if you wanted to modify variableABC, you'd need to do this:
var variableABC = "A B C"; variableABC = variableABC.replace('B', 'D') //output: 'A D C'