Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

Tell us what’s happening:

Hello friends
I’ll be greatful if you help me with step 99

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

let 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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

you have not created the for loop, that was one of the pieces of the for loop, it’s not accepted alone

1 Like

For(let I= count, I=false )like this?

Look at the other for loop commented out in your code for an example of the syntax.

This is how the different parts of the loop are named:

for (<declare iterator>; <condition>; <iteration>) {

}
1 Like