I declare a string of HTML and set it equal to a variable. I can’t think of any reason it would generate an error, yet here it is:
Uncaught SyntaxError: Unexpected identifier on Ln 136.
Ln 136: new_comment = '
<li class="photobooth-comment">
<span class="username">
<a href="#">You</a>
</span>
<span class="comment-text">
' + text + '
</span>
<span class="comment-time">
2d
</span>
</li>
';
If you want to include line breaks in your actual code to make it easier to read, you’re going to need to escape each one with a backslash, e.g.:
Or you’re going to need to concatenate them as individual strings, like so:
Or simply put it all on one line:
Not so easy to read but neater for your JavaScript!