arra filter js code example
Example 1: filter array in js
const rebels = pilots.filter(pilot => pilot.faction === "Rebels");
const empire = pilots.filter(pilot => pilot.faction === "Empire");
Example 2: array.filter in js
var numbers = [1, 3, 6, 8, 11];
var lucky = numbers.filter(function(number) {
return number > 7;
});