I am using NodeJs to create my own API based from Twitter API.
The problem is that:
I have this array of object from Twitter API. It looks something like this.
[
{
...
text: "100% I am sleeping ...",
user: {
screen_name: "Ninja",
},
...
},
{},
...
]
I want know how can I take each “text” and “screen_name” form the list above and store it in a new array of object, to look like this:
[
{
text: "",
screen_name: ""
},
{},
{},
...
]
2
Answers
Use Array.map
Use array map
method
. This will return a new array of objects having desired keys