Is it possible to break JavaScript Code into several lines?

Asked: May 02, 2023

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 the break in the line.
Example:
var x=1, y=2,
z=
x+y;
The above code is perfectly fine, though not advisable as it hampers debugging

Asked by brijesh

Answers (0)

No answers yet. Be the first to answer!