I found a bug in my JavaScript code that I have isolated to a string replace that is acting in a way I didn't expect. Here is an example of the code:
var text = "as";
text = text.replace(text,"$\'");
console.log(text);
This prints an empty string to the console. I was expecting it to print $' to the console. Can anyone explain this?