- Instant help with your JavaScript coding problems

Create multiline string in JavaScript

Question:
How to create multiline string in JavaScript?
Answer:
let multilineText = `This
is
a
multiline
text`;

console.log(multilineText);
Description:

Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them.

Template literals are enclosed by the backtick ` ` character instead of double or single quotes.

Share "How to create multiline string in JavaScript?"
Tags:
javascript, string, multiline, multi-line, template literal
Technical term:
Create multiline string in JavaScript