📜  JavaScript 代码示例中的反向金字塔星形图案

📅  最后修改于: 2022-03-11 15:02:25.697000             🧑  作者: Mango

代码示例1
// Reverse pyramid Or Triangle star pattern in JavaScript
let numberPyramid = 5;
let stringPyramid = '';
for(let i=1; i<=numberPyramid; i++){
  for(let j=1; j<=i -1; j++){
    stringPyramid += ' ';
  }
  for(let k=i; k<=2 * numberPyramid -i; k++){
    stringPyramid += '*';
  }
  stringPyramid += '\n';
}
console.log(stringPyramid);