Test name | Executions per second |
---|---|
Javascript ES6 includes | 11731884.0 Ops/sec |
Lodash intersection | 3214768.8 Ops/sec |
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
var first = [1, 3, 4, 5, 7];
var second = [2, 3, 5, 6];
first.filter(item => second.includes(item))
_.intersection(first, second)