Learn Introductory JavaScript by Building a Pyramid Generator - Step 77

Tell us what’s happening:

I’m supposed to increment the “done” variable in the while loop… How am I not doing this correctly?

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));

let continueLoop = false;
let done = 0;

// User Editable Region

while (continueLoop) {
  done += 1;

// User Editable Region

let result = ""

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


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 77

Hi @joshbailey

To avoid this, start by using the increment operator to increase the value of the done variable inside your loop.

Happy coding

the increment operator is “++” right? or am I mistaken?

That is correct @joshbailey

so “done ++;” is different than “done++;”? Would you mind explaining why it makes a difference? haha

How anyone can explain difference between done++ and done++.? That’s the same incrementing.

done ++; is not correct syntax. JavaScript will read the space between done and the double + and treat them as separate code.

done++; is treated as one piece of code.

Happy coding

1 Like

@Teller Thank you for the explanation. I learned something new about JavaScript syntax. I am new to development and would like to become a full stack developer. Could you please guide and mentor me through this process?

Hi @mrigank.kb

The forum is here to help guide people on their web development journey. If you have a question post it to this forum, so the community can assist.

Everyone’s learning path is different, so be mindful that people idea’s and advice are influenced by personal experiences. What worked or didn’t work for some people may not apply to other people.

Happy coding

1 Like