Learn Introductory JavaScript by Building a Pyramid Generator - Step 61

I keep getting the following error message
“You should call padRow in your .push() call”
but I did call padRow function from .push() call.

please check my code below and comment

const character = “#”;
const count = 8;
const rows = ;

function padRow(rowNumber, rowCount) {
return (“” + character.repeat(rowNumber) + “”);
}
for (let i = 1; i < count; i = i + 1) {
rows.push(padRow(i, count));
}
let result = “”;
for (const row of rows) {
result = result + “\n” + row;
} console.log(result);

Your code so far

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

function padRow(rowNumber, rowCount) {
  //let repeatedCharacter = "" + "#" + "";
  return ("" + character.repeat(rowNumber) + "");
}


// User Editable Region

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

  let result = "";
  for (const row of rows) {
  result = result + "\n" + row;
  }
  console.log(result);


// User Editable Region





Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 61

I think they just want you to call padRow without passing any parameters to it

it worked!!!
thanks to you.

1 Like