Learn Introductory JavaScript by Building a Pyramid Generator - Step 100

Tell us what’s happening:

for (let i = count; i > 0; i–) {
rows.push(padRow(i, count));
}
This is my for loop for inverted pyramid and it works totally fine,an inverted pyramid appears on the console,but when I try to submit the error appears “your for loop should run when i is greater than 0”.I am stuck please help!

Your code so far

const character = "#";
const count = 8;
const rows = [];


// User Editable Region

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}
// Start the loop with i = count and run while i > 0
for (let i = count; i > 0; i--) {
  rows.push(padRow(i, count));
}

let result = "";

for (const row of rows) {
  result = result + "\n" + row;
}

console.log(result);



// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 100

It is good that you are skipping ahead and made the code work but for this step, you will need to click the reset button and focus on just changing the for loop condition which is all they asked for.