Latest Post

Error: No input file specified.

While trying to run a codeigniter app the other day I came across this error just after I had finished uploading the files and making the ne...

Tuesday, February 16, 2010

Javascript - how to continue text in next line



var sometText = 'abc\
defghi';
alert(sometText);



This will not result in a javascript error because each time javascript encounters the single backslash, "\" it knows the statement continues on the next line.

Without the "\", Javascript will assume that the line has ended and give an "unterminated string constant" error.

No comments:

Post a Comment

Chitika Ads