Recently, I was learning functional programming, and I happened to notice in this book, the author uses eight widths of indentation all the time. To be honest, that’s not the coding styled I would like to read/code, and I wasn’t very comfortable reading that enlarged indentation.
I believe that was the arrow function and functional programming thing going on.
Consider the following code
const findLUSlength =
(a,b)=>
a===b
? -1
: Math.max(a.length, b.length)
I wrote those codes hours ago, now I am converting it to 8 width indentation:
const findLUSlength =
(a,b)=>
a===b
? -1
: Math.max(a.length, b.length)
It looks more straightforward to me, my eyes feel more focused on a single function-level scope, and that could be necessary for codes without curly braces.
But the cons come at the same time: it’s much easier to exceed the typical width limit. Which makes it less readable.
I’d stick to less indent for Javascript, and keep it flowing downwards.