0

I have an array like that:

    [{
        id: 1,
        name: 'Proposal'
    },
    {
        id: 2,
        name: 'Contract',
        children: [
            {
                name: 'Approval',
                component: '/approval'
            },
            {
                name: 'Cancellation',
                component: '/cancellation'
            }
        ]
    }]

and another like that:

    [{
        id: 1,
        name: 'Proposal'
    },
    {
        id: 2,
        name: 'Contract',
        children: [
            {
                name: 'Approval',
                component: '/approval'
            }
        ]
    }, 
    {
        id: 3,
        name: 'Example'
    }]

My question is how is the best way to filter arrays, and remove one if have duplicated or more, even in array of children. Or the best, is like arrays merge!

Chiien
  • 331
  • 1
  • 3
  • 11
  • You can try this: https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items?s=1|375.6093 – imvain2 Jul 11 '18 at 18:10
  • Possible duplicate of [How to merge two arrays in JavaScript and de-duplicate items](https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items) – lealceldeiro Jul 11 '18 at 18:24

0 Answers0