Last active
January 5, 2018 18:34
-
-
Save skiano/aa0a3685ba9c120a4b4839ac6bd19dd1 to your computer and use it in GitHub Desktop.
This file contains 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
// logs this pattern | |
// * | |
// * * | |
// * * | |
// * * * * | |
// * * | |
// * * * * | |
// * * * * | |
// * * * * * * * * | |
let x = 1 | |
let size = 8 | |
for (let i = 0; i < size; i += 1) { | |
console.log(' '.repeat(size - i) + x.toString(2).replace(/1/g, '* ').replace(/0/g, ' ')) | |
x ^= x * 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment