Filter() in js is a method that we used when we want to extract some element based on the condition , it stores those value in a new array.
Important point is that we sent function as an argument in a filter(function) method.
This type is called callbyfunction method.
It replaces bulky for loops into single, expressive line of codes.
True stays, False goes: If the test function returns true (or a truthy value) for an item, that item is pushed into the new array. If it returns false, the item is skipped.
Top comments (0)