Line continuation characters in JavaScript

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:

  1. It's not standard JavaScript
  2. A whitespace after that character could generate a parsing error

I like using backslashes for JavaScript line continuation, like so:

    // validation
    $(".adjustment, .info input, .includesAndTiming input, \
        .independentAdj, .generalAdj, .executiveAdj \
        #officeExpense, #longDistanceExpense, #digitalImages, #milesReimbursment, #driveTime, #statementTranscription").keypress(function (event) {

Tags:

Javascript