Suppose I have this array of object:
let arr =
[
{ id: "1"},
{ id: "2"},
{ id: "3"}
]
I would create a list of arrays, so I tried:
arr.map(x => x.id);
but this will return:
["1", "2", "3"]
I want an array for each value, eg: ["1"] ["2"] ["3"]
If you want an array of each then do
arr.map(x=>[x.id]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With