Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let height = +prompt('enter tree height:')
- for (let row = 0, stars = 1, space = height - 1;
- row < height; row++, stars += 2, space -= 1) {
- console.log(' '.repeat(space) + '*'.repeat(stars) + ' '.repeat(space) +
- '" "=' + space + ' *=' + stars);
- }
- console.log(' '.repeat(height - 1) + '*') // foot
Add Comment
Please, Sign In to add comment