What is the best practice for line continuation in JavaScript? I know that you can use \\
for strings. But how would you split the following code?
If I properly understood your question:
var statement = con.createStatement('select * from t where '
+ '(t.a1 = 0 and t.a2 >=-1) '
+ 'order by a3 desc limit 1');
For readability, it is fine to align +
operator on each row:
Anyway, unless you're using Ecmascript 2015, avoid to split a multiline string with \
, because: