我有一个动态的键值对。
myObj = {
category1: ["a","b","c"],
category2: ["a","d","e"],
category3: ["a","f","g"],
...
..
.
}
我需要将交叉值视为“a”。为此,我使用下划线js
_.intersection()
功能
根据动态类别,我需要将动态参数传递给_.intersection()
喜欢
_.intersection(myObj[category1], myObj[category2], ..., ..., myObj[categoryN]);
答案 0 :(得分:3)
尝试:
_.intersection.apply(_, Object.values(myObj));