\" in a javascript string?", "text": "<p>I've been trying some tricks in javascript and came to a ridiculous problem: <em>I can't use <code><script></code> as a substring in a javascript string!</em> Here is an example:</p> <pre class="prettyprint"><code><html> <head> <script> alert("<script></script>"); </script> </head> </html> </code></pre> <p>It supposed to print out <strong><code><script></script></code></strong>, but instead, I get this:</p> <pre class="prettyprint"><code>"); </code></pre> <p>Printed out on the page, as HTML.</p> <p><strong><em>Question:</em></strong> How can I use <code><script></code> followed by <code></script></code> substrings in Javascript, and why is it acting that way?</p> <p>Here is JSFiddle of it.</p>", "answerCount": 0, "upvoteCount": 824, "dateCreated": "2015-02-01 04:13:44", "dateModified": "1970-01-01 00:00:00", "author": { "type": "Person", "name": "Victor2748" } } }