Last active
December 5, 2018 20:42
-
-
Save Floofies/1c459397a6180e842ac54874300d5957 to your computer and use it in GitHub Desktop.
Generates binary expansion integers in order
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* binaryExpansionGenerator(int = 1, roof = 2048) { | |
while (roof > int) { | |
int = int * 2; | |
yield int; | |
} | |
}; | |
console.log(Array.from(binaryExpansionGenerator())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment