js multiline string with ` code example

Example 1: Multi-Line JavaScript

console.log(`i am a multiline
string
and it works
but not on all browsers
- yet
`);

Example 2: javascript multiline string

const multilineString = `This
is
a
multiline
string
in
javascript`;

Example 3: javascript variable with multiline text

let multilineText = `This
is
a
multiline
text`;

console.log(multilineText);

Example 4: javascript multiline string

// Creating multi-line string
    var str = `<div class="content">
                  <h1>This is a heading</h1>
                  <p>This is a paragraph of text.</p>
               </div>`;
    
    // Printing the string
    document.write(str);

Example 5: js multiline string with variables

const htmlString = `${user.name} liked your post about strings`;