1const array = [
2 {
3 username: "john",
4 team: "red",
5 score: 5,
6 items: ["ball", "book", "pen"]
7 },
8 {
9 username: "becky",
10 team: "blue",
11 score: 10,
12 items: ["tape", "backpack", "pen"]
13 },
14 {
15 username: "susy",
16 team: "red",
17 score: 55,
18 items: ["ball", "eraser", "pen"]
19 },
20 {
21 username: "tyson",
22 team: "green",
23 score: 1,
24 items: ["book", "pen"]
25 },
26
27];
28//FILTER MEMBERS IN TEAM "RED"
29const filterArray=array.filter(word=>word.team==="red")
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 ]
1function isBigEnough(value) {
2 return value >= 10
3}
4
5let filtered = [12, 5, 8, 130, 44].filter(isBigEnough)
6// filtered is [12, 130, 44]
7
1Thank you for this post,I have a question about filter you show all variant but how we can take filter (From-To)