i tried to replace a string, provided the string regex with a value that has $ in the end.

Can anyone tell me what is happening in
Looking into mdn string replace docs, i found it is expected.
But what should one do he want to ignore this.
Means i want the replacing value should get as it is replaced, with 4 $s here.