Under "using default values" that second example where you assign the value first? I'd never do that for the simple waste of the value being assigned twice if the second case is true. The final example in that section with the ternary operator is a better choice.

Might help if you called it what it is in that part. "ternary"

I've also been hearing the "too much going on" claim thrown against code where it's more some pedantic career educator flapping their arse-cheeks in the wind, than it is legitimate complaint. It's not always the case, but far too often it's being used to split up functions in a way that's bad for code clarity as it sends you off hunting somewhere else for where the operation has been moved, and/or wastes a bunch of processing overhead with "functions for nothing".

Which in languages like JavaScript is our latest woe, these people who seem to want every blasted line of code to have its own dedicated functions, and this hot and trendy BS of throwing the needlessly painfully cryptic arrow functions and callbacks at EVERYTHING.

This idea of a function "doing too much" and that somehow splitting it into multiple functions even when it's code that would only ever be called once from one place? Utter nonsense.

Again, not always the case, but it's getting too "popular" a practice being thrown at everything.

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