Multi-Line


The line continuation character in JavaScript is the back slash.

var mystring = 'this is my ' + 
'string that spans ' +
'three lines';

can be written as this
If you copy and paste this code check there are no extra spaces after any of the backslashes
This is known as Backslash Newline Escaping

var mystring = 'this is my \  
'string that spans \
'three lines';


Template Literals

Using Template Literals provides an alternative way to get multi-lines.



© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext