First off, line breaks can be a big problem in javascript. And as Neil said, you need to avoid your quotes. Sometimes breaking up a longer line makes it more readable. Alternatively, you can provide the setTimeout function instead of a string. Here is an example:
setTimeout(function() { var nameTag = '<div class="name">David</div>'; var timeTag = '<div class="time">test</div>'; var commentTag = '<div class="indiv-comment"><p>' + message + '</p></div>'; var wrap = '<div class="video_comment">' + nameTag + timeTag + commentTag + '</div><hr class="gray" />'; $('#user-comments').append(wrap) }, 3000);
This way you can clearly see which quotes start and end where you don't have to worry about linear errors inside the string.
source share