0

please tell me how can I use recursion to pull out an object with id: 3 through findItem (only 3 comes to findItem for iteration) I've been scratching my head for a very long time how to iterate over arrays of objects of unknown nesting

const items = [
  {
    title: 'Production',
    id: 1,
    subTasks: [
      {
        title: 'Production 1',
        id: 2,
        subTasks: [{ title: 'Production 1 - 1', id: 3 }, { title: 'Production 1 - 2', id: 4 }],
      },
    ],
  },
  {
    title: 'Test',
    id: 5,
    subTasks: [],
  },
]

I will be very grateful for your help!

vinograd
  • 93
  • 4

0 Answers0