I need something like heredoc in JavaScript. Do you have any ideas for this? I need cross-browser functionality.
I found this:
heredoc = \'\\
As others have said, ES6 template strings give you most of what traditional heredocs provide.
If you want to go a step further and use a tagged template string, theredoc is a nice utility function that lets you do this:
if (yourCodeIsIndented) {
console.log(theredoc`
Theredoc will strip the
same amount of indentation
from each line.
You can still indent
further if you want.
It will also chop off the
whitespace-only first and
last lines.
`)
}