Answers for "who to accses to an object vallue inside an array with .filter method js"

6

who to accses to an object vallue inside an array with .filter method js

const array = [
  {
    username: "john",
    team: "red",
    score: 5,
    items: ["ball", "book", "pen"]
  },
  {
    username: "becky",
    team: "blue",
    score: 10,
    items: ["tape", "backpack", "pen"]
  },
  {
    username: "susy",
    team: "red",
    score: 55,
    items: ["ball", "eraser", "pen"]
  },
  {
    username: "tyson",
    team: "green",
    score: 1,
    items: ["book", "pen"]
  },

];
//FILTER MEMBERS IN TEAM "RED"
const filterArray=array.filter(word=>word.team==="red")
Posted by: Guest on January-03-2021
0

js filter items by index

let newArray = arr.filter(callback(element[, index, [array]])[, thisArg])
Posted by: Guest on July-14-2020

Code answers related to "who to accses to an object vallue inside an array with .filter method js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language