Coding Best Practices (JavaScript) - Write small functions

Janaka Chathuranga
4 min readOct 31, 2018

The idea is simple. Do not write long functions.

Do not write functions longer than 50 lines. — ESLint (Default Configuration)

The default configuration of ESLint enforces that maximum lines in function to 50 lines.

I prefer it to be maximum 20 lines.

The smaller the better. ;)

Why 20 Lines?

It reduces complexity of your code. Makes it easy to understand. Okay, that you knew already I guess. ;)…

--

--