DEV Community

Understanding Javascript Array Series XII - Array Loops & Iteration Part IX

Nedy Udombat on October 14, 2019

In the previous article, I talked about iterating over arrays using the Array.find() array method. You can check it out below: ...
Collapse
 
chimexi_42 profile image
Chima Chidera Okoro •

Is there any difference between the find and filter method?

Collapse
 
nedyudombat profile image
Nedy Udombat •

Yes, the find method looks for the first element that first a particular criterion while the filter element gets all the element that fits a criteria and stores them in a new array.

Collapse
 
chimexi_42 profile image
Chima Chidera Okoro •

Okay thanks... helpful

Collapse
 
__naaza profile image
Naza •

Nice

Collapse
 
nedyudombat profile image
Nedy Udombat •

Thank you @__naaza

Collapse
 
dreman3082 profile image
Oluwadamilare Alonge •

This is really good

Collapse
 
nedyudombat profile image
Nedy Udombat •

Thank you @dreman3082

Collapse
 
akintoluvic profile image
Vick Greenfields •

Well done, in summary, arr.find() finds a described value while arr.findIndex() finds the index of such a value

Collapse
 
nedyudombat profile image
Nedy Udombat •

Yes @akintulovic.

Collapse
 
bamiogunfemi profile image
bamiogunfemi •

Awesome read

Collapse
 
nedyudombat profile image
Nedy Udombat •

Thank you @bamiogunfemi