0 votes
in JavaScript by
How do you define multiline strings in Javascript?

1 Answer

0 votes
by

You can define multiline string literals using the '\' character followed by line terminator.

var str =
  "This is a \
very lengthy \
sentence!";

But if you have a space after the '\' character, the code will look exactly the same, but it will raise a SyntaxError.

...