Created
December 31, 2019 22:48
-
-
Save solimanware/dddf26483105316e67d3656398aab94c 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
let treesize = 10; | |
let counter = treesize; | |
let arr = []; | |
//tree | |
for (let i = 0; i < treesize; i++) { | |
arr.push(' '.repeat(counter) + '*'.repeat((i*2)+1)); | |
counter--; | |
} | |
//trunk | |
for (let i = 0; i < treesize/3; i++) { | |
arr.push(' '.repeat(treesize-1) + '*'.repeat((3))); | |
} | |
console.log(arr.join('\n')); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment