Read more
Allow multiple line of code for a string variable in Javascript
2014-09-22
JavaScript
When we set a html string to a variable, we cannot come to next line with only press enter like in php, example below show the case:
$htm = '';
You will get a warning like this:
SyntaxError: unterminated string literal
Usually, we will use "+" to link up multiple line of code to solve this problem. Today I found a way to allow this which just easily add a "\" at the end of a line.
$htm = '';