on-internet
← Community

Why escape the slash (“/”) in a string literal containing a closing “” tag?

Stack Overflow ·

I have seen everyone doing it tho I don't get why. document.write('<script src="src"><\/script>'); I mean using the single ' you shouldn't need to escape chars?

Comments

Sign in or sign up to comment and upvote.

No comments yet.