I want to be able to create a variable to hold several lines of text which is then created in Photoshop. My code that creates the text works fine. But I've a problem with my code formatting:
var content = "Gwen\r\
is\r\
bananas!\r";
However, after I process the text it comes out as this:
Notice the introduction of the whitespace on the second and third line. I don't want to have to format my code on the left like this to remove the string literal spaces.
var content = "Gwen\r\
is\r\
bananas!\r";
In my code, how can I break up/format the text over several lines without having to left justify the text? Avoiding introducing any further whitespace characters?


I have a solution for you. You can use template literals. This solution include placing backticks `. One before the string and one at the end of String. Here's the code:
You can also use string concatenation by applying + after each line. Here's the code:
Note: You can use single quotes too.