By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,448 Members | 901 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,448 IT Pros & Developers. It's quick & easy.

Unterminated String constant in JS

P: 2
in IE only I am getting an "Unterminated String constant" when running a script.

The error states line 20072 char 62.

I have looked on this line and cannot see why it would throw this error? -

The page can be found at the link, I would post the code but it is very large!

http://www.nctfleetlist.co.uk/search_result.php?
Feb 9 '12 #1

✓ answered by Dormilich

that’s correct, JavaScript’s strings are not multiline (except when you manually escape the newline).

Expand|Select|Wrap|Line Numbers
  1. // invalid
  2. var mystring = "1 2 3
  3. 4 5 6";
  4.  
  5. // valid
  6. var mystring = "1 2 3" +
  7. "4 5 6";
  8. // also valid
  9. var mystring = "1 2 3\
  10. 4 5 6";

Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
that’s correct, JavaScript’s strings are not multiline (except when you manually escape the newline).

Expand|Select|Wrap|Line Numbers
  1. // invalid
  2. var mystring = "1 2 3
  3. 4 5 6";
  4.  
  5. // valid
  6. var mystring = "1 2 3" +
  7. "4 5 6";
  8. // also valid
  9. var mystring = "1 2 3\
  10. 4 5 6";
Feb 9 '12 #2

P: 2
Thanks a lot, had a feeling it would've been something I had overlooked!

:)
Feb 9 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.