Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Like this?:

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

that is a better one. What do the tests say?

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Its the first time, it actually says, nothing…

what do you mean? what do you see?

Before it said nothing. But I guess it works now. But why isn’t (rowCount - rowNumber) added to the character.repeat part

because it doesn’t match the number, you want only 1 character if you are at rowNumber of 1, if you use rowCount - rowNumber it’s not 1

1 Like

@im59138 But the next step doesn’t work the same way? (Step 70)

if you have questions about step 70 please open a topic for step 70

crea una variable = le pones los space.repeat y el resto de instrucciones, y luego lo llamas al principio y al final