can you please explain how composeFrogFilterers is not creating the line:
return frogs.filter(filter)
from the filterFrogs function
while the above function :
applyAllFilters
does create this line 4 times instead of 1 like you mention?
from the logs i did, both run 4 times not just one
can you please say where iam wrong:
inside applyAllFilters:
for(letindex=0;index<filters.length;index++){constfilter=filters[index];console.log('newfrogs leng: ',newFrogs.length);newFrogs=filter(newFrogs);// calling filter function on new frogs array.filter}
inside composeFrogFilters:
returnfns.reduce(function(accumulatedFrogs,fn){console.log('leng of acc frogs: ',accumulatedFrogs.length);returnfn(accumulatedFrogs)// also calling frogs array.filter with the fn as filter func},frogs)
You are right, both of the examples both re-create the arrays. Will edit the post with the correct solution (check my response to your other reply for the solution)
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.
can you please explain how composeFrogFilterers is not creating the line:
return frogs.filter(filter)
from the filterFrogs function
while the above function :
applyAllFilters
does create this line 4 times instead of 1 like you mention?
from the logs i did, both run 4 times not just one
can you please say where iam wrong:
inside applyAllFilters:
inside composeFrogFilters:
You are right, both of the examples both re-create the arrays. Will edit the post with the correct solution (check my response to your other reply for the solution)