Step 64: JS Build a Pyramid

I believe it kooks right and meets the goals.

What I have for the function:

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

I get these errors:

  1. You should use the .repeat() method.
  2. You should pass rowNumber to your .repeat() call.
  3. You should return the result of your .repeat() call.
    I need tips, ideas, maybe a new set of eyes to replace my current set of weary, dripping tears eyes!

Please post a link to the Step. Thanks


I don’t think this step wanted you to change the call to .repeat() for character?

Oh

Use the return keyword to return the value of the character variable, repeated rowNumber times.

Your are returning a bunch of spaces that are not mentioned in the instructions. Only repeat character rowNumber times.

I think looking for answers I found there are two different sets of instructions that are, or have tripped up my code. There is a lesson that says something like “It’s time to do some math” and how the lessons evolved from that has twisted things up badly. I suppose I should return to Step 50 and try working it out from there?
Thanks Sir JeremyLT!

I wouldn’t go look up other peoples answers as 1) the step numbers sometimes change and 2) really the ‘answer’ isn’t the point so much as figuring out how to fix your code.

For this step, I would do only and exactly what the instructions say

You should only return character repeated rowNumber times and nothing else.

The challenge has had extra steps added to it. I would look at the list of all the steps on the main page and go back to the first uncompleted step you see and start from there.


The code you have posted is for step 68 (and is correct).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.