Google News
logo
JavaScript - Interview Questions
Is it possible to break JavaScript Code into several lines?
Breaking within a string statement can be done by the use of a backslash, '\', at the end of the first line
 
Example :
document.write("This is \a program");
And if you change to a new line when not within a string statement, then javaScript ignores break in line.
 
Example:
var x=1, y=2,
z=
x+y;
The above code is perfectly fine, though not advisable as it hampers debugging.
Advertisement