I have a string in Javascript where I have to escape several characters:
<script>
function GenerateCode() {
alert(ctry);
var script = "<script async src=\"//somesite.com/feed/livetrend.js\"></script>";
}
</script>
I have tried the following to escape the characters:
var script = "<script async src=\"//somesite.com/feed/livetrend.js\"></script>";
However, this does not work correctly, despite having taken care of including an escape character \ in front of "
It an error -unterminated string constant.
</script>tag to mean that script is inline in the HTML?