Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

Tell us what’s happening:

Step 99 Introductory Jave Script

"Because you are going to loop in the opposite direction, your loop needs to run while i is greater than 0. You can use the greater than operator > for this.

Set your loop’s condition to run when i is greater than 0.“”

Im stucked

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 > 0; true; 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 (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 99

Remember that for loops have to be written a specific way.

The first part is the declaration of the variable you are using using a let statement.
The second part is the condition which has the statement that the loop will check each time to see if it should repeat or not.

solucion:
mod edit: solution removed

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.