Zac Gross

Code & More

Binary Combinations in Javascript

| Comments

While writing test coverage for a recent javascript project I was required to test every possible call to a function with a large number of binary parameters. Here is the function I came up with to generate the combinations:

It’s pretty straight forward, pass in the length (n) of binary digits and it will return an array of all possible combinations as boolean values.

Comments