The way that I thought of doing this first was to try and replace all of the new line characters with a space. That would leave me a single line of text. That would work, but it’s a fair bit of processing, not to mention code, for something so simple.
So I did some research…
var my_string = `First Line
Of course, there’s compatibility issues with some older browsers, so if you need to support older versions this may not be for you. If you are lucky enough to not have to worry about older browsers, then this is definately the trick for you.