I need to extract, from this array
const mylist = [
{
"key": "",
"doc_count": 3
},
{
"key": "IT",
"doc_count": 1
}
]
an array of the values of key:
["", "IT"]
Today I use a simplistic approach
finalList = []
_.forEach(myList, function (element) {
finalList.push(element.key)
})
but I saw that lodash has several methods which are almost the ones for my case: _.zip/_.unzip, _.fromPairs/_.toPairs and _.zipObject
Is there a way to simplify this code based on a lodash method?