Learn Introductory JavaScript by Building a Pyramid Generator - Step 77

Tell us what’s happening:

Need help with this code. I believe the increment should be within 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));
}*/

let continueLoop = false;
let done = 0;


// User Editable Region

while (continueLoop) {
  done ++;
  console.log(done);
}




// 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 77

Hi,
In this step you only need to increment, which you have done already.
No need to console log the variable. So remove that part.

1 Like

Hi JuniorQ, I have done that and the code is not going through

Tell us what’s happening:

My code still doesnt go through . Any assistance please.

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

}

// 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 77

Can you share your new code?
Maybe there is a problem with the indent.

I checked your new code. There is a problem with the indent in your code.
You need to add done ++; after two spaces inside the function.
Hope this helps.

Hi and welcome,
can you share that part of your code please?

HI @katneeson99 !

Welcome to the forum!

Please create your own topic with your code, so we can assist you.
thanks

I have merged your two topics together.

As for your code here

it passes on my end

try resetting the lesson and trying again.
or maybe try another browser

I’m having the same issue.

done ++; but it says I didn’t increment it. I know it’s still in beta. Is this step broken??

I removed the space “done++” and it accepted it. :roll_eyes: