Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

Tell us what’s happening:

I do not understand what I am being asked here, it says to initialise “i” with the value of “count” and to use false as placeholders for the rest of the loop

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 (i = count, false, 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

the for loop has 3 parts correct (not including the actual code in the body of the loop).
The initialization statement. Usually it is something like let i=0 because many times we want to start looping from 0. In this case they want to start looping from the value of count.
The other two parts of the for loop are the conditional expression (which checks to see if we should even do this loop) and the afterthought expression (which contributes to how the loop variable i gets changed after each loop executes)
They want these other two expressions to be false. So just type that in ‘false’ in their place as “place-holder” for now.

Make sure you are using the correct syntax (using semi-colons, not commas). More on for loops here:

1 Like

Thank you, that worked! I always forget the semicolon lol

1 Like