Javascript – avoid nesting ifs

When writing conditional blocks of logic try to avoid nesting, for example, consider the below: This kind of nesting can make code hard to extend, hard to read and hard to debug, so we can move everything up to the top level like:

Published
Categorized as Javascript