Learn Introductory JavaScript by Building a Pyramid Generator - Step 95

Tell us what’s happening:

Im not sure what mistake I’m making here.

I wrote i > 0

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 = count; i > 0; i--) {
  rows.push(padRow(i, count));
}


// 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 95

you need to give space in between i > 0

Ive added a space between I > 0 but still doesn’t work

why do you have this line here?

The line rows.push(padRow(i, count)); is included in the loop to generate each row of the pyramid using the padRow function and then add thes rows to the rows array, ensuring the pyramid structure is correct. But I may have gone slightly ahead

it’s not there in the starting code

Should i cross it out and leave the code ‘for (let i = count; i > 0; i–) {’

when you have the starting code for a step, you should add only what instructed and not extra things, you may want to reset the step to be sure of removing all extra things

for (let i = count; i > 0; i--) {

}
[quote="ilenia, post:8, topic:694806, full:true"]
when you have the starting code for a step, you should add only what instructed and not extra things, you may want to reset the step to be sure of removing all extra things
[/quote]

I tried this code and its still not passing - I'm not sure what I'm doing wrog

do only what is asked in the instructions, if you do more you fail