Learn Introductory JavaScript by Building a Pyramid Generator - Step 43

Tell us what’s happening:

for (let i = 0; i < count; i = i + 1) {
character. push(#);
}
Error message says “push your character variable,” which is what I thought I was doing. So what am I missing?

Your code so far

const character = "#";
const count = 8;
const rows = [];


// User Editable Region

for (let i = 0; i < count; i = i + 1) {
  character.push("#");
}

// 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/126.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 43

Instead of pushing i to the array,

So, you need to exchange the i for another value. The array is rows

push the value of your character variable.

rows.push(i);

This is pushing i to the array rows. You need to push character to the array rows

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.