问题:在控制台怎么输出倒三角形?
使用JavaScript中的for循环来做;
for(var a=0,b=" ";a<10;a++){
b+="*";
console.log(b);
}
输出:
*
**
***
****
*****
以上代码输出的是正三角形;但是我怎么都想不通倒三角形该怎么写?
我想输出:
*****
****
***
**
*
求教各位该怎么写?
初学js,望多多包涵哈!~
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
输出结果: