Much of this is horrifically BAD advice, and more of it is outright broken gibberish, some of which even clearly says you don't understand scope or how let/const is actually MORE likely to get you into trouble than prevent actual problems.

Let's start with that garbage foo() function in terms of maximum statements per line. In what scenario is setting block scoped variables (that do nothing VAR wouldn't) even useful Much less if it always returns true, it's returning but two things, and Jack left town.

Gets worse with the "empty line" example, whist sure it provides clarity, it might help to STOP slopping "const" onto every blasted line for no reason. Comma's exist, use them!

Same with that derpy "empty line before returns" where there are no empty lines before your returns, and that code saves but two things, jack and shit.

Since if you want to typecast loose false to a uniform undefined, "return baz || undefined".

But what do I know, I consider "method chaining" to be dumbass garbage that should NEVER have become a thing in JavaScript in the first place. In a "code clarity, what's that?!?" kind of way.

Particularly the derpy use of JS to do CSS' job that you have there, the pinnacle of "how NOT to use JavaScript"

But that's like alert for debugging being "bad" -- says who? Sometimes you WANT to pause the execution instead of letting it blindly plod on like console.log does.

Arguing in favor of things dropped in Strict doesn't speak well either. Admittedly, I like "with" which is removed from strict, but given that it's an obsolete function we are explicitly told not to rely on existing?

But the cherry on top is your use of switch/case. Not only adding block level structures for no reason, but your let and const are UTTERLY HUFFING USELESS as they do not exist outside the scope you declared them. That's what let/const DOES and you seem to have ignored that, utterly breaking any practical functionality there.

NOT that your source is any more useful since what it declares doesn't exist outside the switch. Again how let/const utterly banjaxes so many codebases.

Either way your code is utter and complete broken gibberish that has zero practical use! What the blazes good is declaring a let x=1 that only exists inside the switch statement itself?

This whole "block level" scoping thing remains some of the most dumbass nonsense I've seen in programming the past four decades. I don't like it in C, there's no reason to drag this derpitude into JavaScript.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store