js filter method on arrays code example
Example 1: array.filter in js
var numbers = [1, 3, 6, 8, 11];
var lucky = numbers.filter(function(number) {
return number > 7;
});
Example 2: js filter items by index
let newArray = arr.filter(callback(element[, index, [array]])[, thisArg])