The filter() method creates an array filled with all array elements that pass a test provided as a function.
5.1
[1, 2, 3, 4, 5].filter(function(value, index, arr) {
return value > 2;
});
6
[1, 2, 3, 4, 5].filter(value => value > 2);
Results in a new array:
[3, 4, 5]
Fi...