Learn Introductory JavaScript by Building a Pyramid Generator - Step 84

Tell us what’s happening:

i am confused as to why it keeps on saying this is wrong i have tried each and everything but nothing seems to be working

Your code so far


// User Editable Region

const character = "#";
const count = 8;
const rows = [];

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

let continueLoop = true;
let done = 0;

while (continueLoop) {
  done++;
  rows.push(padRow(done, count));
  if (done === count) {
    continueLoop = false;
  }
}

let result = "";

for (const row of rows) {
  result = result + "\n" + row;
}

console.log(result);

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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 84

Inside your if body, assign the boolean false to your continueLoop variable.

you made other changes, reset the step and do only this

The instruction only ask to update the if statement.
Delete this line.

deleted 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++) {
}
/

let continueLoop = false;
let done = 0;

while (continueLoop) {
done++;
if (done === count) {
continueloop = false;
}
}

let result = “”

for (const row of rows) {
result = result + “\n” + row;
}

console.log(result);

Did it work?

Side note:

To post your code to the forum, put your code between 2 lines of 3 backticks, like this:

```
# your code here
```

Or use the Preformatted Text button (</> Symbol):

I got it, you messed up with this comment.

It should be

/*for (let i = 1; i <= count; i++) {
  rows.push(padRow(i, count));
}*/

Reset and try again.
For the next time, don’t make change to other code.

no it did not i did remove it but not sure why it is not

Just reset and try again.
If it didn’t work, post your updated code.

i reset it and said what u told me to

// TODO: use a different type of loop

/*for (let i = 1; i <= count; i++) {

rows.push(padRow(i, count));

}*/

let continueLoop = false;

let done = 0;

while (continueLoop) {

done++;

if (done === count) {

continueloop=false;

}

}

let result = “”

for (const row of rows) {

result = result + “\n” + row;

}

console.log(result);

Please re-post your updated code.
Put your code between 2 line of 3 backticks like I said above

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));
}*/

let continueLoop = false;
let done = 0;

while (continueLoop) {
  done++;
  if (done === count) {
continueloop=false;
  }
}

let result = ""

for (const row of rows) {
  result = result + "\n" + row;
}

console.log(result);

The variable name is continueLoop with the capital L, not continueloop