DEV Community

Discussion on: 5 things I learnt during my latest Javascript Code Kata

 
erikpischel profile image
Erik Pischel

Now I see your point. The advantage I see in this case is that a seperate "filter" step represents a seperate step in the algorithm. Like "step 1: filter out all edges that connect only one node. step 2: ...". If you use the filter condition in the forEach directly it gets more entangled with the next step.

Thanks for your comment.