Here is a Array list.
const list = [
{
id: 5844,
option: 'fruit'
children: ['apple', 'banana', 'pear']
},
{
id: 5845,
option: 'vegetables'
children: ['tomato', 'potato', 'spinach']
}
]
I want to get a new array like this
apple of fruit's children is index 0
tomato of vegetables's children is index = 0
so they are match
[['apple', 'tomato'], ['banana', 'potato'], ['pear', 'spinach']]