Hi SerjoA, thank you for the suggestion and the workaround!
I will edit the post and swap out the current code example with the example you provided because its correct.
I'm going to make a slight modification to your combineFilters function to run this instead:
combineFilters
function combineFilters(...fns) { return function (frog) { for (let i = 0; i < fns.length; i++) { const filter = fns[i] const passes = filter(frog) if (passes) { continue } else { return false } } return true } }
This is a slightly more optimized version which reduces the amount of iterations as much as possible.
Thank you!
great, looks good
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi SerjoA, thank you for the suggestion and the workaround!
I will edit the post and swap out the current code example with the example you provided because its correct.
I'm going to make a slight modification to your
combineFilters
function to run this instead:This is a slightly more optimized version which reduces the amount of iterations as much as possible.
Thank you!
great, looks good