Learn Introductory JavaScript by Building a Pyramid Generator - Step 92

Tell us what’s happening:

my code seems right, what am I doing wrong? i = i - 1?

Your code so far

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

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

// TODO: use a different type of loop
/*for (let i = 1; i <= count; i++) {
  rows.push(padRow(i, count));
}*/

/*while (rows.length < count) {
  rows.push(padRow(rows.length + 1, count));
}*/

// User Editable Region

for (let i = i - 1; i > 0; false) {

}



// User Editable Region


let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 92

Hi there. The iteration part goes on the right side of the for loop where the false; not the left. The left part is where you set the initial value of the counter. I’d personally hit reset to restore the code.

Happy coding.

ok but I don’t understand why? what it does?

The for loop construct has three parts. Going from left to right they are. The initializer,which sets your initial value. The condition which determines if the for loop should keep going. Then you have the incrementer, which runs every loop and used to represent the loops progress.

1 Like

without false , false is here not correct