DEV Community

Discussion on: Clean JavaScript - 10 Tips

pavelloz profile image
Paweł Kowalski

That array of ifs approach is brave :)
I usually just extract ifs (sometimes grouped) to functions.

If there is too much, then function isEligible appears and it holds the checks (including those pure functions checking for simple things).