The pattern
To keep oversight with complex or long multiline strings I sometimes use an array pattern:
text = <<"HERE" This Is A Multiline String HERE
is not available in js (I remember using it much in my good old Perl days).To keep oversight with complex or long multiline strings I sometimes use an array pattern:
var myString =
['<div id="someId">',
'some content<br />',
'<a href="#someRef">someRefTxt</a>',
'</div>'
].join('\n');
or the pattern anonymous already showed (escape newline), which can be an ugly block in your code: var myString =
'<div id="someId"> \
some content<br /> \
<a href="#someRef">someRefTxt</a> \
</div>';
0 comments:
Post a Comment