【发布时间】:2023-01-08 17:18:44
【问题描述】:
如何将以下对象转换为以下输出JavaScript?目前我有以下对象。你能建议我吗?
[
{
"attrTitle": "color",
"attrValue": "Green"
},
{
"attrTitle": "size",
"attrValue": "M"
},
{
"attrTitle": "size",
"attrValue": "L"
},
{
"attrTitle": "size",
"attrValue": "S"
},
{
"attrTitle": "color",
"attrValue": "Red"
}
]
我期望的输出如下
[
{
"attrTitle": "color",
"attrValue": ["Red", "Green"]
},
{
"attrTitle": "size",
"attrValue": ["S","L","M"]
}
]
【问题讨论】:
标签: javascript typescript