Lim*_*eat 0 javascript arrays object
我有对象数组的对象
{
"94":[{"Full Name":"Phalla Morn"}],
"95":[{"Full Name":"Pum Chhenghorng"}],
"99":[{"Full Name":"Proen Pich"}]
}
Run Code Online (Sandbox Code Playgroud)
我想将其转换为对象数组:
[
{"Full Name":"Phalla Morn"},
{"Full Name":"Pum Chhenghorng"},
{"Full Name":"Proen Pich"}
]
Run Code Online (Sandbox Code Playgroud)
请帮忙.
获取内部数组Object.values(),并通过扩展到Array.concat()以下内容展平:
const arr = {"94":[{"Full Name":"Phalla Morn"}],"95":[{"Full Name":"Pum Chhenghorng"}],"99":[{"Full Name":"Proen Pich"}]};
const result = [].concat(...Object.values(arr));
console.log(result);Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
98 次 |
| 最近记录: |