gpt4 book ai didi

javascript - angularjs:动态键:值对作为函数的参数

转载 作者:行者123 更新时间:2023-11-28 17:45:37 24 4
gpt4 key购买 nike

我有一个动态的键值对。

myObj = { 
category1: ["a","b","c"],
category2: ["a","d","e"],
category3: ["a","f","g"],
...
..
.
}

我需要将交集值设为“a”。为此,我使用下划线js_.intersection()函数

根据动态类别,我需要将动态参数传递给_.intersection()

喜欢

_.intersection(myObj[category1], myObj[category2], ..., ..., myObj[categoryN]);

最佳答案

尝试:

_.intersection.apply(_, Object.values(myObj));

关于javascript - angularjs:动态键:值对作为函数的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46804584/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com