Learn Introductory JavaScript by Building a Pyramid Generator - Step 66

Tell us what’s happening:

My error is “You should call padRow in your .push() call.” So I thought .call had to be in there, but I also tried replacing it with .push, but it didn’t work either. I have reset this lesson about five times and am stuck. I tried replacing the rows with padRow and that didn’t work either. What am I missing?

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.call());
}

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

calling a function need its name with round brackets like that functionName().

I’m sorry, but I am not understanding. For may padRow.call(), I need to have something within the ()?

You don’t call a function by adding .call() to it.

Here is how I call the print() function:

print()

Thank you. That makes sense.

1 Like