Last active
April 10, 2017 04:43
-
-
Save sairion/84f9debba1ac85099abe7ae4c427f045 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
function range(limit) { | |
return Array.from(Array(limit)).map((_,i) => i) | |
} | |
function piramid(height = 10) { | |
return range(height).reduce((ret, i) => { | |
let space = ' '.repeat(height - i) | |
let slope = '*'.repeat(i) | |
return ret + `${space}${slope}*${slope}${space}\n` | |
}, '\n') | |
} | |
for (let i = 1; i < 10; i++) { | |
console.log(piramid(i)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment