Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 500 Bytes

File metadata and controls

16 lines (11 loc) · 500 Bytes

JavaScript - Filter method

Filter is one of the methods to traverse the arrays.

It will take callback as input and selects the elements to include in the result based on the returned boolean expression inside the callback.

The callback function would be excuted for every element of the array.

It will return the new array by not changing the original array.

  • Syntax:
    const newArray = Array.filter((parameter) => {
        return // boolean expression;
    });