输出以下图形
<script type="text/javascript">
// 5.输出以下图形 (扩展:尽能力去做)
// *
// ***
// *****
// *******
// *****
// ***
// *
for(let i = 0; i < 4; i++){
let str = "";
for(let j = 0; j < 2 * i + 1; j++){
str += "*";
}
// console.log(str);
let space = "";
for(let j = 0; j <= 4 - 1 - i; j++){
space += " ";
}
console.log(space + str);
}
for(let i = 0; i < 3; i++){
let str = "";
for(let j = 0; j < 2 * (3 - i) - 1; j++){
str += "*";
}
let space = "";
for(let j = 0; j < i+2; j++){
space += " ";
}
console.log(space + str);
}
</script>