Skip to main content
InterviewHubPRO
Section Overview
Q315

Question 315 of 536

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

59%
JavaScript & V8 Internals (536 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

How do you write multi-line strings in template literals

mid LevelCode ExampleComponents

In ES5, you would have to use newline escape characters('\n') and concatenation symbols(+) in order to get multi-line strings.

javascript
  console.log("This is string sentence 1\n" + "This is string sentence 2");

Whereas in ES6, You don't need to mention any newline sequence character,

javascript
  console.log(`This is string sentence
  'This is string sentence 2`);