Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

Tell us what’s happening:

Hi there

I am doing what it says but it won’t work. in the user editable region

Thanks in advance
Iskren

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

for (i = count; false; false){
  
}

// 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 99

you need to declare the variable, you are missing a keyword for that

1 Like

for (const i = count; false; false) {

}

still not working

the variable i will need to change for the loop to work, if you use const it can’t never change

1 Like

const i=count;

for(i; false; false){

}

let i=count;

for(i; false; false){

}

That is not asked to add here.

Here you need to declare the i using declaration keyword let and initialize it by assigning count variable to it.

1 Like