// JavaScript codes to print a pyramid with 10 rows
const count = 10;
let result = "";
const rows = [];
const character = "*";
function padRow(rowNum, rowCount){
return " ".repeat(rowCount - rowNum) + character.repeat(2 * rowNum - 1) + " ".repeat(rowCount - rowNum);
}
for(let i = 1; i<=count; i++ ){
rows.push(padRow(i, count));
}
for(const row of rows){
result = result + row + "\n";
}
console.log(result);