Line continuation characters in JavaScript

前端 未结 4 450
情话喂你
情话喂你 2021-02-03 17:21

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?

4条回答
  •  [愿得一人]
    2021-02-03 17:37

    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) {
    

提交回复
热议问题