我有一个动态的键值对。

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/

10-12 05:27