📅  最后修改于: 2022-03-11 15:02:25.697000             🧑  作者: Mango
// 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);