Learn Introductory JavaScript by Building a Pyramid Generator - Step 94

Tell us what’s happening:

I don’t get wat I’m not doing correctly I created a variable I and initialize it with the value of count but it keeps telling,
Me I need to initialize I with the value of count

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

count = 10
for (i = count; false; false) {pō
}

// 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/125.0.0.0 Safari/537.36 Edg/125.0.2535.51

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 94

1 Like

i see some hidden characters at the end of your for statement
maybe try again after you reset?

Also don’t forget to use let in the for loop

1 Like

you are missing “const” and “let” keyword for count & i variables

1 Like

This worked for me "code removed by mod”

1 Like

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You have missed the let keyword to initialize the i variable in the for loop.

Thank u that fixed it

Ohh, I got it. Thanks for letting me know.

1 Like