DEV Community 👩‍💻👨‍💻

Jack Pritom Soren
Jack Pritom Soren

Posted on

JavaScript Array Methods : Filter()

The filter() method creates a new array with all elements that pass the test implemented by the provided function.

Example:

const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter(word => word.length > 6);

console.log(result);
//Output: Array ["exuberant", "destruction", "present"]
Enter fullscreen mode Exit fullscreen mode

Filter

Latest comments (2)

Collapse
 
andrewbaisden profile image
Andrew Baisden

These ES6 JavaScript Array Methods really make our work less tedious.

Collapse
 
jps27cse profile image
Jack Pritom Soren Author

Yes, ES6 has made our job easier.

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠