DEV Community

Discussion on: 5 Programming Patterns I Like

xtofl profile image
xtofl • Edited

These patterns are so useful in day to day work!

In the 'one loop two arrays' pattern for partitioning I like to emphasize what is the essential, minimal difference in each condition. In this case, it's really just 'what array do I append to?'

var target =
    predicate(example) ? 1 : 0];