Friday, 15 April 2011

javascript - Is "Bad Line Breaking" obsolete with "use strict"? -



javascript - Is "Bad Line Breaking" obsolete with "use strict"? -

please assume 'use strict'; please assume jslint on , errors cannot ignored.

i find operators , ',' initiated lists much more readable, e.g.:

var = 0 , j = 1 , somelongvariablename1 , somelongvariablename2 , somelongvariablename3 , somelongvariablename4; if( ( 'dcr' === cmd && (action) && ('get' === actionhttp || 'post' === actionhttp ) && whatever ) { ... }

hence question: "bad line breaking" obsolete "use strict"?

edited: 'use strict'; not prevent execution of bad line breaking code. can prevent execution of kinds of errors.

i see jslint , jshint treat bad line breaking differently. jshint much friendlier towards syntax prefer. may solution others working on this.

unfortunately, strict mode doesn't disable horror automatic semicolon insertion, , "bad" line breaks remain issue. example:

(function() { "use strict"; console.log(foo()); function foo() { var = 1, b = 2; homecoming + b; } })();

live example | source (you need open console , @ it)

that still logs undefined rather 3, because asi kicks in , adds semicolon after return in foo.

javascript jslint use-strict

No comments:

Post a Comment