I was just doing stuff in microsoft edge console, and I noticed that when I type in the following:
str = "<script>"
it returns with the value of the string as:
Why did it add a backslash?
Juan Pablo Isaza
It's formatting it the way you should do it if you were writing the string in a
<script> block of an HTML file. In these blocks you should not write
</script> literally, because they'll be parsed as starting or ending the block. The escaped character prevents them from being recognized as those HTML tags.
This is somewhat related to Why split the <script> tag when writing it with document.write()?