Inserting a new line into a template string?

reectrix picture reectrix · Mar 17, 2018 · Viewed 18k times · Source

I've tried splitting it into two lines:

const templateString = `this is my template 
                        string`

And I've also tried:

const templateString = `this is my template\n string`

But none of these work. The templateString still comes out as one line. How do you create multi-line template string?

Answer

enf0rcer picture enf0rcer · Mar 20, 2018

That would require a <br> tag. Your first attempt is the correct one, if you add the <br> tag.