loading
Please wait while loading...
Back Allow multiple line of code for a string variable in 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 = '';
Comments
comments powered by Disqus