`string.replace` weird behavior when using dollar sign ($) as replacement
<p>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:</p>

<pre><code>var text="as";
text = text.replace(text,"$\'");
console.log(text);
</code></pre>

<p>This prints an empty string to the console.  I was expecting it to print $' to the console.  Can anyone explain this?  </p>
