I’m trying to convert some Ruby code that uses a multiline string into JavaScript. In Ruby, I can write:
text = <<"HERE"
This
Is
A
Multiline
String
HERE
I want to achieve the same effect in JavaScript, storing multiple lines of text in a single variable.
What’s the best way to handle multiline string javascript? Are there specific syntax options or modern features (like template literals) that make this easy?
For example, I’d like the variable to contain:
This
Is
A
Multiline
String
without having to concatenate individual strings manually.