I'm new to Node.js and I want to access a particular set of information from an object that looks like this:
userData: [
{
value: false,
id: 1,
title: 'Hello World',
date: '17 February 2018 - 06:27:51 PM',
status: 'Processing'
},
{
value: false,
id: 2,
title: 'Hello People',
date: '17 February 2018 - 06:27:48 PM',
status: 'Active'
},
{
value: false,
id: 3,
title: 'Hello Canary',
date: '17 February 2018 - 06:27:44 PM',
status: 'Expired'
}
]
Now I want to return an array that consist of only "title"
Example: ['Hello World', 'Hello people', 'Hello Canary']
I have tried Object.values(obj)
and Object.keys(yourObject).map(key => yourObject[key])
without any luck. Can anyone please help me?
Update: I'm using ES6 and would like to optimize my code for performance