Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

You should call .repeat on your " " strings to repeat them rowCount - rowNumber times.
I don’t understand what else I’m supposed to do here. I’m at an end. Nothing on the forum has helped thus far.

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  return " " + character.repeat(rowNumber) + " ".repeat(rowCount - 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 + row + "\n";
}

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/130.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

you have two strings " "

My brain seemed to immediately find the solution right after I made this post. Solved.

1 Like

Hi @gemhoarder and welcome to the FCC community!

Think about the symmetry of the pyramid and how you can achieve that symmetry with those blank spaces. You are on the right path and have the first part of this correct! Now, you just need to achieve symmetry by making both sides equal.