I can't seem to find an answer to this question because I don't really know what this is called, if there's a solution already point me there.
I'm trying to use this from underscore.js
_.intersection(*arrays)
I understand I can use the function like so:
var intersection = _.intersection(['a','b'], ['a','c'])
and get
['a']
back.
I have a variable amount of arrays however, so I want to do something like this:
var intersection = _.intersection(array for array in my_arrays)
I understand I could do this:
var intersection = my_arrays[0];
my_arrays.forEach(arr => intersection = _.intersection(intersection, arr) )
But that doesn't seem clean. How can this be done? Thanks.