Is script tag inside javascript string object currently forbidden?

Viewed 31

I try this: let textValue='<script></script>' but I get an error stated

Uncaught SyntaxError: Invalid or unexpected token unexpected token

Unterminated string literal

I am wondering do javascript currently forbid the use of <script> tag for string object.

1 Answers

You can do it like this:

let textValue='<script>content<\/script>';
console.log(textValue);

Related