There are two ways to break up a Javascript string into multiple lines: Backslashing and string concatenation.

String concatenation is often easier on your eyes, but slower and more memory intensive. If speed and performance is a goal than you should always delimit your JavaScript strings with backslashes and not plus signs.

Delimiting with backslashes

  1. var text = “Lorem ipsum dolor sit amet,\
  2. consectetur adipisicing elit,\
  3. sed do eiusmod tempor incididunt\
  4. ut labore et dolore magna aliqua.”;

Delimiting with string concatenation

  1. var text = “Lorem ipsum dolor sit amet,”
  2.          + “consectetur adipisicing elit,”
  3.          + “sed do eiusmod tempor incididunt”
  4.          + “ut labore et dolore magna aliqua.”;