Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

Tell us what’s happening:

function padRow(rowNumber, rowCount) {
return “rowwCount” + character.repeat(rowNumber) + "rowNumber ";
}

what am i doing wrong thanks for all your help in advance don’t understand what they want you too do here thanks.

Your code so far

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


// User Editable Region

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

// User Editable Region


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

let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

Update your blank space strings to be repeated rowCount - rowNumber times.

you still need to have the string with the space inside and use the repeat function, reset the step and try again

1 Like

I think this is what you mean not 100 percent thanks again as still not passing

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

This is calling repeat on character.

character.repeat(rowCount-rowNumber)

It would help if you replaced the character with an empty string. That way, you’ll be calling repeat on an empty string.

thank you for your help i appreciated it highly,thanks again i am over the moon i have solved this and now completed this thanks again.

1 Like

You are very welcome. Keep doing the good work.

return “” + character.repeat(rowCount-rowNumber) + “”;
what is the problem here on my code where should i write my rowCount-rowNumber

[quo
i have already gotten the answer thank you

1 Like