About Multiline Strings in JavaScript

Use trim() method to remove leading and trailing whitespace from multiline strings:

let html = `
<h1>Hello World!</h1>
<p>This is my first post</p>
`.trim()

Tips and Tricks Programming JavaScript