JavaScript replace() method dollar signs
<p>I have a string like <code>aman/gupta</code> and I want to replace it to <code>aman$$gupta</code> and for that I am using JavaScript <code>replace</code> method as follows:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let a = "aman/gupta"
a = a.replace("/", "$")
console.log(a) // 'aman$gupta'

a = "aman/gupta"
a = a.replace("/", "$$")
console.log(a) // 'aman$gupta'

a = "aman/gupta"
a = a.replace("/", "$$$")
console.log(a) // 'aman$$gupta'</code></pre>
</div>
</div>
</p>

<p>Why are the 1st and 2nd case identical and I get the expected result when I use <code>$$$</code> instead of <code>$$</code>?</p>