I’m trying to make one loop christmas tree using string.repeat method.
let Height = 6;
let Star = "*";
for (let i = 0; i < Height; i++) {
for (let j = 0; j <= i; j++) {
document.write(Star);
}
document.write("<br>");
}
I’ve created it on 2 loops, but don’t know how to do it on a single one. Thank you for help.