Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

Okay so I have been stuck on this step for an hour now and I’ve gotten as far as these two ideas:

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

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

I’ve had a look at questions from other coders and some of the hints but none of m helped.

The first choice is the correct syntax but you wrote your calculation in the brackets wrong way around. It should be:

rowCount - rowNumber

Thank you! :)) all good now

1 Like