Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

Tell us what’s happening:

hi guys is that mean that i have one statement with 3 elemet of iterator =count , condition,iteration ? that i should apply false for condition and iteration element?

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;
for(false){condition,iteration;}

// 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; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

1 Like

Yes the last two are false as per the instructions.
Recall for loops are usually written like this:
for (iterator; condition; iteration) {}

2 Likes

i wrote like this
for(count;condition=false;iteration=false){}
but do not know where exactly should i apply the false boolean in loop!!

1 Like

hi there!
the instructions is:
Start by creating a new for loop. Declare your iterator i and assign it the value of count , then use the boolean false for your condition and iteration statements.
example:

for (iterator; condition; iteration) {

}
2 Likes

hi there
like this you mean?
for(iterator;condition;iteration){}
for(false){condition;iteration}!!

Look for another for loop in your code for the correct syntax to declare i

The other parameters should be false instad of condition and iteration

1 Like
for (iterator; condition; iteration) {

}

Take the above code seriously as an example. And do that, which is asking in the challenge instructions.

3 Likes

It may help you to read about for loops a bit more here:

1 Like

Oh thank you brother Hasan
That was a great reminder
Some times some emphasizes are great light

2 Likes

2 posts were split to a new topic: Step 99 pyramid generator