I'm new to backreference. I have an array and need to replace it in string.
Here's my try:
var cc = ["book","table"];
var str = "The $1 is on the $2";
var newstr = str.replace(cc, "$2, $1");
console.log(newstr)
I'm new to backreference. I have an array and need to replace it in string.
Here's my try:
var cc = ["book","table"];
var str = "The $1 is on the $2";
var newstr = str.replace(cc, "$2, $1");
console.log(newstr)
That's... hmm, I'm not sure I can understand the kind of confusion of ideas that would lead you to write such a thing...
Try this: