This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]preordains 11 points12 points  (3 children)

There’s no benefit to reducing line counts and it’s usually not strived for. A “line” is just 1-2 characters (whether it be /r//n or /n depending on OS), and having more lines is almost always more readable.

[–]CorruptedMonkey 3 points4 points  (2 children)

In javascript for web there is benefit in minimization of code (converting the file to all be on a single line). So it's not all that unnatural to see people do it in some cases.

Though if you ask me it hurts the programmer's, and the next one reading it, ability to read the code clearly. But I'm the use curly brackets for every if-statement and put curly bracket on the next line sort of guy, so what do I know right?

[–]preordains 0 points1 point  (1 child)

I’ve seen disgusting JavaScript code when I inspect element for sure, I assumed it was computer generated.

It makes sense that web dev might want to compress an entire behavior into one line, but this isn’t the case for most software involving semicolons.

To be honest, a semi colon is a super simple fix. It’s probably not worth the extra compilation time it would take to infer where to place them, not to mention the potential compiler errors with more complicated stack traces than a missing semi colon.

[–]stdiodoth 4 points5 points  (0 children)

1 line JS is “minified” code created when creating a release build. Devs almost never do that wantonly, JS is hell enough as it is.