I have an object array like this:
var input = [{ time: '11:01:00', data: 'a,b,c' }, { time: '11:01:11', data: 'a,b,c' }]
After I call:
var output1 = input.map(a => a.data);
console.log(output1);
The result would be:
[
"a,b,c",
"a,b,c"
]
Now I want the final output will be:
[
{data: ["a","a"]},
{data: ["b","b"]},
{data: ["c","c"]},
]
I have tried many way but no hope to do this.