JavaScript Array Methods : Filter()

Jack Pritom Soren - May 20 '22 - - Dev Community

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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player