I have an array object like below:
[
{
first: "A",
second: "B"
},
{
first: "C",
second: "D"
},
]
and I want to convert to an array like this:
[
[
"A",
"B"
],
[
"C",
"D"
],
]
It would be highly appreciated if anyone can advise me!😊
Advertisement
Answer
You could map the values.
const
data = [{ first: "A", second: "B" }, { first: "C", second: "D" }],
result = data.map(Object.values);
console.log(result);