About Multiline Strings in JavaScript

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

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

Tips and Tricks Programming JavaScript