I want to convert this:
data= [{id: 1, name: 'james', country: 'US'}, {id: 2, name: 'john', country: 'NG'}]
to this:
newdata =[[1,'james', 'US'], [2,'john', 'NG']]
I tried pushing the data to a new array but couldn't give me my desired result:
const newdata = [];
for (let index = 0; index < data.length; index++) {
newdata.push(data[index].name);
}
but it's giving me just the names. I understand that this line data[index].name is the cause.
data.map(Object.values)