One very common operation in programming is to iterate through an Array's contents, apply a test function to each item, and create a new array containing only those items the passed the test. For example, let's say you wanted to loop through an array of stocks and select only those with the price larger than a certain value. In this lesson we will demonstrate how to use the Array's
filter method to easily perform this operation with less code than a loop would require.
Very helpful! I should've watched this a long time ago.
Hi, great content!
I'd like to know if the use of filter instead of regular "IF" is better for performance or is just to keep code clean?? Thanks!
I have no idea why always use
console.log(JSON.stringify(....)) instead of
console.log(...). Does it has any extra benefits?
Only benefit is that the output is fully expanded. It's good for lessons.
Jafar Husain, you are the worst instructor that i have found here. Very awful examples, not for beginners. Your examples doesn't interested for beginners like me. Post the more simple samples.
What is the predicate param you passed when defining the filter method.
Are map, forEach and filter considered with Asynchronous function? Could you please explain for me about this?