SOURCE

for (let i = 1; i <= 4; i++) {
    let c = '';
    for (let j = 0; j < i + 4; j++) {
        if (j <= 4 - i) c += ' ';
        else c += '*';
    }
    console.log(c);
}
let j = 6;
for (let i = 1; i <= 3; i++) {
    let c = ' ';
    for (let k = 1; k <= j; k++) {
        if (k <= i) c += ' ';
        else c += '*';
    }
    console.log(c);
    j--;
}
console 命令行工具 X clear

                    
>
console