After spending countless hours searching through Stack Overflow and other resources, I am still unable to understand what is happening here. Any assistance would be greatly appreciated!
I am trying to convert document.write('</div>');
to -> < /div>
I have simplified the problem to its most basic form in the following HTML example.
<script>
var str = "document.write('</div>');";
str = str.replace("/document.write/g","");
console.log(str); //</div>
</script>