4 ms·
What you have there is a gen-you-wine clusterfsck, my friend. You need at least a handful of variables to name and hold your intermediate values. Putting names
by rcoder 18y ago
What you have there is a gen-you-wine clusterfsck, my friend.
You need at least a handful of variables to name and hold your intermediate values. Putting names on things is good. It lets you refactor and debug your code in a reasonable way, without doing partial function application in your head.
Furthermore, it aids in doing reasonable functional decomposition. If you have several terms to which you're applying similar operations, that may be a natural target for abstraction via a function. Without the intermediate assignments, though, the syntactic noise of parenthesis, ternary statements, and weird spacing tends to mask the commonalities in actual code flow.
Even worse, by making so many inline function definitions and applications, you've re-defined 'this' to mean several different things in a single scope. Full-time JS jockies may be used to that, but it makes my head hurt.
Code like this screams to me that the author would rather rewrite it completely (or force someone else to do so) than change it.