As the title suggests, I am trying to create a single array of strings:
['string1', 'string2', 'string3', 'string4', 'string5', 'string6']
Out of an array of objects with arrays of strings within those objects:
[
{
array_of_strings: ['string1', 'string2', 'string3']
},
{
array_of_strings: ['string1', 'string4', 'string5']
},
{
array_of_strings: ['string6', 'string3', 'string2']
}
]
As you can see there is a possibility that the nested arrays may contain the same strings as each other, and I am trying to de-duplicate at the same time. I got very lost in map
, filter
and reduce
. But nothing really outputs the data as needed.
Any guidance would be appreciated.