I have an array of arrays:
[
[1,2],
[2,3],
[4,3]
]
I want to pass them to a underscore-function as a series of variables.
_.intersection([1,2],[2,3],[4,3])
How can this be done?
I have an array of arrays:
[
[1,2],
[2,3],
[4,3]
]
I want to pass them to a underscore-function as a series of variables.
_.intersection([1,2],[2,3],[4,3])
How can this be done?
You can use apply
_.intersection.apply(_, myArr);
this
context to be set on the called method.The apply() method calls a function with a given this value and arguments provided as an array (or an array-like object).