The HTML parser does not understand JavaScript and therefore is looking for something to close the </script> . If you need '</script>' as a string in JavaScript, just use '</s'+'cript>' .
JavaScript isself does not have such a problem, using var x = '</script>'; in nodejs is not a problem. HTML parser.
source share