// 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 += '
';
}
console.log(stringPyramid);