1var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
2
3const result = words.filter(word => word.length > 6);
4
5console.log(result);
1const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
2
3const filter = arr.filter((number) => number > 5);
4console.log(filter); // [6, 7, 8, 9]
5
1var numbers = [1, 3, 6, 8, 11];
2
3var lucky = numbers.filter(function(number) {
4 return number > 7;
5});
6
7// [ 8, 11 ]
1// The filter() method creates a new array with all elements
2// that pass the test implemented
3
4const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
5
6const result = words.filter(word => word.length > 6);
7
8console.log(result);
9// expected output: Array ["exuberant", "destruction", "present"]
10