【发布时间】:2017-03-17 15:31:52
【问题描述】:
我是 javascript 新手,我想使用不可变 js 完成一项任务。 我有一张这样的地图:
const clients = Map({
"c1": {
"id": "c1",
"isLegalEntity": false,
"wantsEstatements": true,
"portfolios": {
"a": {
"id": "a",
"type": "Cash"
},
"b": {
"id": "b",
"type": "Margin"
}
}
},
"c2": {
"id": "c2",
"isLegalEntity": false,
"wantsEstatements": true,
"portfolios": {
"e": {
"id": "e",
"type": "Cash"
},
"f": {
"id": "f",
"type": "Margin"
}
}
}
})
我想创建三个表。第一个表将包含“c1”和“c2”值,所以从我读过的文档中我使用了 clients.keys() 属性。 另一个表必须包含所有投资组合 ID,如下所示:[“e”,“f”],最后一个表必须包含所有投资组合类型,如下所示:[“cash”,“margin”],但我不知道如何从文档中执行此操作。你知道怎么做吗?
【问题讨论】:
标签: javascript iteration immutable.js