Algorithm 06: Filter Array by Second Array

This algorithm did not come from a challenge but instead from a project I was working on.  I had an array of objects (in this example I use ‘projects’) that had to be filtered with another array.  The second array contained the values needed to exist in the first array of objects in order for them to be included in the new array.

I refactored the original function into a more es5 friendly version.  The first version relays on the includes(); method that is not available in some older browsers.

Like to leave a comment?

Comments have been automatically closed on this post but don't let that stop you. Hit me up on following networks: