tree works with any height
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
let space = ' ';
|
let space = ' ';
|
||||||
let star = '*';
|
let star = '*';
|
||||||
let bar = '|';
|
let bar = '|';
|
||||||
|
let magassag = 10;
|
||||||
|
let width = magassag * 2 - 1;
|
||||||
|
|
||||||
|
for (let i = 1; i < magassag + 1; i++){
|
||||||
for (let i = 1; i < 8; i++){
|
|
||||||
|
|
||||||
let starnum = i + i - 1;
|
let starnum = i + i - 1;
|
||||||
let spacenum = (13 - starnum) / 2;
|
let spacenum = (width - starnum) / 2;
|
||||||
|
|
||||||
|
|
||||||
let line = space.repeat(spacenum) + star.repeat(starnum) + space.repeat(spacenum);
|
let line = space.repeat(spacenum) + star.repeat(starnum) + space.repeat(spacenum);
|
||||||
@@ -14,7 +15,7 @@ for (let i = 1; i < 8; i++){
|
|||||||
console.log(line);
|
console.log(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
let spnum = (13 - 3) / 2;
|
let spnum = (width - 3) / 2;
|
||||||
let barnum = 3;
|
let barnum = 3;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user