【发布时间】:2019-05-03 11:08:03
【问题描述】:
您好,我正在尝试从对象中提取一些信息来创建图形,但它返回 undefined 我的对象看起来像
{
"concepts": [
{
"id_cpt": "1",
"fr_cpt": "Proche",
},
{
"id_cpt": "2",
"fr_cpt": "Loin",
}{
"id_cpt": "3",
"fr_cpt": "Here",
},...
],
"arcs": [
{
"idfrom":"1",
"idto":"2"
},
{
"idfrom":"3",
"idto":"2"
},....
]
}
我想让一个对象看起来像
const data = {
nodes: [{ id: 'Proche' }, { id: 'Loin' },{ id: 'Here' } ...],
links: [{ source: 'Proche', target: 'Loin' }, { source: 'Here', target: 'Loin' },...]
};
我想在链接中提取名称而不是 id,但对象弧只有 es6 中的代码的 id,谢谢你帮助我
【问题讨论】:
标签: javascript arrays ecmascript-6 es6-map