Skip to content

Instantly share code, notes, and snippets.

Fastest function to intersect a large number of big arrays in javascript, without dependencies

* The compressed version is only 345 caracters long. * Faster than common libraries, even a large number of arrays, or on very big arrays. (See benchmarks) *

Usage

array_intersect(array1, array2, ..., arrayN)

How it works

The idea is simple and comes from here: http://pioupioum.fr/developpement/javascript-array-intersection.html.