Please assume 'use strict'; and also assume that, JSLint is on and errors cannot be ignored.
I find operators and ',' initiated lists so much more readable,
e.g.:
var i = 0
    , j = 1
    , someLongVariablename1
    , someLongVariablename2
    , someLongVariablename3
    , someLongVariablename4;
 if( (
     'dcr' === cmd
      && (action)
      && ('get' === actionHttp || 'post' === actionHttp )
      && whatever
   ) { ... }
Hence my question:
Is "Bad Line Breaking" obsolete with "use strict"?
EDITED: 'use strict'; will not prevent the execution of bad line breaking the code. It can prevent the execution of some kinds of errors.
I see that JSLint and JSHint treat bad line breaking differently. JSHint is much friendlier towards the syntax I prefer.
So that, may be a solution for others who are working on this.
Unfortunately, strict mode doesn't disable the horror that is automatic semicolon insertion, and so "bad" line breaks remain an issue. For example:
(function() {
  "use strict";
  console.log(foo());
  function foo() {
    var a = 1, b = 2;
    return
    a + b;
  }
})();
Live Example | Source (you need to open the console and look at it)
That still logs undefined rather than 3, because ASI kicks in and adds a semicolon after the return in foo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With