Filter the array of objects

How can I filter arrayObjects to return ["test1", "test2", "test3"]

const arrayObjects = [{
  date: "2021-02-17",
  someAction: [{
    id: "1",
    metatags: {
      addedBy: "test1"
    }
  }, {
    id: "2",
    metatags: {
      addedBy: "test2"
    }
  }]
}, {
  date: "2021-02-16",
  someAction: [{
    id: "3",
    metatags: {
      addedBy: "test1"
    }
  }]
}, {
  date: "2021-02-15",
  someAction: [{
    id: "4",
    metatags: {
      addedBy: "test3"
    }
  }, {
    id: "5",
    metatags: {
      addedBy: "test2"
    }
  }]
}]

I`m writing something like this:

arrayObjects?.map(arr => arr.someAction.map(a=> a.metatags.addedBy))

30 thoughts on “Filter the array of objects”

  1. Pingback: cialis mg
  2. Pingback: viagra sale amazon

Leave a Comment