I wonder what is best and easiest way to get elements by array element from collection - is it possible by using native js?
Here is what is the case:
const ids = [1, 2, 3, 4]
const collection = [{id: 2}, {id: 234}, {id:1}, {id: 345}, {id: 3}, {id:4}, {id:323}];
Expected output should looks like that:
[{id: 1}, {id: 2}, {id: 3}, {id: 4}]
Is there already something built in to lodash? I know we can use filter and indexOf but I wonder what is the shortest and easiest way to do this.