Skip to content

Instantly share code, notes, and snippets.

View marcymon97's full-sized avatar

Marceline marcymon97

  • Nova Iguaçu, Rio de janeiro - BR
View GitHub Profile
@matthewkastor
matthewkastor / array.intersect.js
Created January 23, 2013 06:21
JavaScript Array intersection functions. Check out the performance tests at http://jsperf.com/nopub/2
/**
* See: http://stackoverflow.com/a/1885766
*
* Note: because this function transfers array values
* to an object's properties, the result set will consist
* of unique values. Given [1,2,3,3] and [3,3,4,5] this
* function will return [3].
*
* This function attempts to avoid doing extra work
* by assigning all values from the array given as