Learn Introductory JavaScript by Building a Pyramid Generator - Step 87

Tell us what’s happening:

What could be the issue with this code. I don’t really get it.

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


// User Editable Region

let done = 0;

while (rows.length <= count) {
  (rows.length + 1)++;
  rows.push(padRow(rows.length + 1, 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 87

1 Like

You have modified your code. Reset your challenge and remove

Equal from while loop condition.

And that argument is correct. You modified done++;, that was should not be modified.
@Bouff_Daddy

Instructions:

You’ll need to change the while condition to use the less than operator, instead of the less than or equal operator.

Your code:

It seems you missed a required thing to do

Thank you guys for the input

:saluting_face: :sweat_smile: :sweat_smile: :sweat_smile: :sweat_smile:This is really Good