Created
October 8, 2013 06:30
-
-
Save Leask/6880388 to your computer and use it in GitHub Desktop.
Exhaustive all cases of filling A, B, C, D in to a ten elements array.
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 output(intIn) { | |
| strIn = intIn.toString(4); | |
| var aL = ['A', 'B', 'C', 'D']; | |
| var msk = '0000000000'; | |
| var len = msk.length; | |
| var str = msk + strIn; | |
| var rtn = ''; | |
| str = str.substr(str.length - len, len); | |
| arr = str.split(''); | |
| for (var i in arr) { | |
| rtn += aL[arr[i]]; | |
| } | |
| console.log(rtn); | |
| } | |
| var max = Math.pow(4, 10); | |
| for (var i = 0; i < max; i++) { | |
| output(i); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment