I have an array here:
a = [1, 1, 2, 3, 4, 5, 5, 6, 7, 7]
and another,
b = [1, 2, 5]
I want to find all occurrences of each element of array b in a. i.e. I want a resultant array like this:
result = [1, 1, 2, 5, 5]
I was going through the Lodash docs to find any combination of methods which would give me the result, but haven't managed to do so. Does anyone know how I can get the result array? I prefer to use a very concise solution (i.e. without too many loops etc), and usually Lodash is best for that, but other solutions are also fine.