When writing JavaScript code, it's likely you'll encounter a really long string literal at some point. There are two ways you can format them nicely in your editor without inserting any actual line breaks into the string.

Concatenation

Your first option is to use the + operator to concatenate multiple strings:

let sentence = 'Espresso is a coffee-brewing method of Italian origin, ' +
'in which a small amount of nearly boiling water (about 90 °C or 190 °F) is ' +
'forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure ' +
'(expressed) through finely-ground coffee beans.';

// Espresso is a coffee-brewing method of Italian origin, in which a small amount of nearly boiling water (about 90 °C or 190 °F) is forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure (expressed) through finely-ground coffee beans.
console.log(sentence);

This doesn't insert any actual line breaks, but it lets you write the string across multiple lines to keep it nice and readable.

Backslashes

Your other option is to insert a backslash at the end of each line:

let sentence = 'Espresso is a coffee-brewing method of Italian origin, \
in which a small amount of nearly boiling water (about 90 °C or 190 °F) is \
forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure \
(expressed) through finely-ground coffee beans.'
;

// Espresso is a coffee-brewing method of Italian origin, in which a small amount of nearly boiling water (about 90 °C or 190 °F) is forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure (expressed) through finely-ground coffee beans.
console.log(sentence);

Once again, this doesn't insert any actual line breaks.

The nice thing about this method is that you don't have to keep opening and closing quotes, which is usually quite error-prone. But you do need to make sure you don't add any characters after the backslashes—including any whitespace—otherwise you'll get a SyntaxError. So it's swings and roundabouts.

Comparison with template literals

Using an ES6 template literal, you can break a string into multiple lines. However, this will actually insert the line breaks into the string:

let sentence = `Espresso is a coffee-brewing method of Italian origin, 
in which a small amount of nearly boiling water (about 90 °C or 190 °F) is
forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure
(expressed) through finely-ground coffee beans.
`
;

/* Espresso is a coffee-brewing method of Italian origin,
in which a small amount of nearly boiling water (about 90 °C or 190 °F) is
forced under 9–10 bars (900–1,000 kPa; 130–150 psi) of atmospheric pressure
(expressed) through finely-ground coffee beans. */

console.log(sentence);

Credits

Credit to the MDN Web Docs for teaching me about the backslash method. Despite several years' experience in vanilla JS, I never knew you could do this until recently! 🤦‍♂️

Thanks also to Wikipedia for the espresso description. ☕️