Created
May 3, 2015 15:22
-
-
Save JavaScript-Packer/2fd9b24d3ed2ec95297a to your computer and use it in GitHub Desktop.
Get all possible combinations and permutations for 8-bit binary. Live demo on http://jsfiddle.net/eur7o7eL/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function possible(e, n, t, r, W) { | |
if (0 === e.length) { | |
return []; | |
} | |
if (1 === e.length) { | |
return e[0]; | |
} | |
n = [], t = possible(e.slice(1)); | |
for (r in t) { | |
for (W = 0; W < e[0].length; W++) { | |
n.push(e[0][W] + t[r]); | |
} | |
} | |
return n; | |
} | |
alert(possible([ [ "1", "0" ], [ "1", "0" ], [ "1", "0" ], [ "1", "0" ], [ "1", "0" ], [ "1", "0" ], [ "1", "0" ], [ "1", "0" ] ])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minified version: