Skip to content

Instantly share code, notes, and snippets.

View sergiks's full-sized avatar

Sergei Sokolov sergiks

  • Russia | Europe | Thailand
View GitHub Profile
@sergiks
sergiks / script
Created April 27, 2015 18:00
All combinations of at least two array elements
/**
* Test to figure out combinations of at least two elements of provided array.
*
* by Sergei Sokolov, [email protected], 2015 April 27, St. Petersburg.
* Fiddle: http://jsfiddle.net/sergiks/2ojgqxk1/
*/
function comb(a) {
var l, cursor, mask, tail, out=[];
l = a.length;
if( l<2 || l>32) {