0

I know this is beyond simple but for some reason I'm stuck in a rut with this one. I'm simply trying to declare a string as shown in the code below, however it's generating the following error.

Uncaught SyntaxError: Invalid or unexpected token

var myString = "<script src='http://some.somedomain.com/some/path/to/some/thing/thing.js'></script>";

Question: Why is this string declaration throwing the error?

6
  • Is this code inside a <script> tag itself? Commented Sep 20, 2016 at 17:45
  • you need to escape the end <\/script> Commented Sep 20, 2016 at 17:46
  • @FelixKling yeah it is, left it out for clarity. Commented Sep 20, 2016 at 17:47
  • 1
    Leaving it out made the question less clear, actually. Commented Sep 20, 2016 at 17:47
  • @mplungjan You nailed it, thank god for you lol... quick question though, so I'm writing a bot in C that scans and basically identifies regex patterns (basically detect external files) so the program won't have the <\/script only </script> closing tag, any ideas here? Commented Sep 20, 2016 at 17:50

0