Created
October 29, 2016 16:59
-
-
Save nukosuke/39810fedead4b96385cd4457b87a5712 to your computer and use it in GitHub Desktop.
co3496558でやってたピラミッド作る問題
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
function createPyramid(height){ | |
return Array.from({length: height}, (v,k) => k+1) | |
.map(r => ' '.repeat(height-r).concat('*'.repeat(r*2-1))) | |
.join('\n'); | |
} | |
console.log(createPyramid(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for文で書くとこうかな