Javascript Array Of Object Value Into Multidimensional Array
I am in process of learning expressJS with NodeJS. I am trying to insert multiple rows into mySQL table. Since the bulk insert query requires data like [['a',1], ['b',2], ['c',3]]
Solution 1:
You could pass Object.values
as parameter to map
like this:
const input = [
{
"productID" : 1,
"stock": -3
},
{
"productID" : 1,
"stock": 5
}
]
const output = input.map(Object.values)
console.log(output)
Post a Comment for "Javascript Array Of Object Value Into Multidimensional Array"