SOURCE

console 命令行工具 X clear

                    
>
console
for (let i = 1; i <= 4; i++) {
    let temp = "";
    for (let j = 1; j <= 4 - i; j++) {
        temp += " ";
    }
    for (let k = 1; k <= 2 * i - 1; k++) {
        temp += "*";
    }
    console.log(temp);
    }
    for (let i = 1; i <= 3; i++) {
        let temp = "";
        for (let j = 1; j <= i; j++) {
        temp += " ";
    }
        for (let k = 1; k <= 7 - 2 * i; k++) {
        temp += "*";
    }
console.log(temp);
}
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" type="text/css" href="">
</head>
<body>
	<script src = ./ling.js></script>
</body>
</html>