I have an an array of tags linked to an article which contains nested objects:
[ {id: 1, name: {"en": "Tag 1" }}, {id: 2, name: {"en": "Tag 2" }}, {id: 3, name: {"en": "Tag 3" }} ]
I want to create a new array which simply shows the tag name is a single array:
[Tag 1, Tag 2, Tag 3]
I created the following method:
var tagNames = [];
this.article.tags.forEach(value => {
tagNames.push(Object.values(value["name"]));
});
console.log(tagNames);
However, this creates an array of arrays:
[[Tag 1],[Tag 2],[Tag 3]]
How can I achieve the single array I want?