Learn Introductory JavaScript by Building a Pyramid Generator - Step 66

Tell us what’s happening:

for (let i = 0; i < count; i = i + 1) {
rows.push(padRow);
}
This is what I have written, please let me know if there is something more that I need to add to this.

Your code so far

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

function padRow(rowNumber, rowCount) {
  return character.repeat(rowNumber);
}



// User Editable Region

for (let i = 0; i < count; i = i + 1) {
  rows.push(padRow);
}

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

Hi there! It is not a variable, it is a function

Hi there!
You need to call the padRow function within .push() method. Currently you have only referencing it.

thank you! I am still stuck, "for (let i = 0; i < count; i = i + 1) " should I make any changes here. I have taken help from online platforms yet I am still stuck, Ik this is going to be something so simple where I am stuck but please help

Your loop is correct, the issue is in your function call. For example, how do you call a function?

using the function name followed by parentheses , like padRow();

Exactly, followed by parentheses! Now look at your call:

o my god, thank you so so much, I have been freaking stuck at this from yesterday, I am so stupid, it was so simple. Thanks again!!

1 Like