例如
a = [{foo: '1', things:[1,2]},{foo: '2', things:[3,4]}]
b = someFunction(a)
b 的内容现在是:
[{foo: '1', thing: 1}, {foo: '1', thing: 2},
{foo: '2', thing: 3}, {foo: '2', thing: 4}]
其中 bar 是从 things 中的每个元素派生的,但“things”也可以很容易地是我想要与对象 {foo: '1',..... 的外部属性组合的对象数组。 ...,arraOfThings: [] }
这个有名字吗?
最佳答案
这称为concatMap
使用函数式编程语言 Haskell。
关于javascript - 'map' 的名称是什么 'expands' 而不是一对一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46626438/