Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

Please I need help.. I don’t seems to understand what’s going on here.. I tried everything I could but still not responding.. please help me

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  return ".repeat(rowCount - rowNumber)" + 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 (Linux; Android 12; CPH2387) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

you put the repeat method inside the string so now it’s not a method anymore, it’s a string

instead you want to use the method on the string, that means putting the starting . after the closing " quote

I suggest resetting the step and trying again

1 Like
  • this just a string, what you need is to make use of that blank spaced string to use “repeat” method
  • do this for both " " string

happy coding :slight_smile:

Ok . Thank ls for that.. but the blank space you guys are talking about is it not the space in tween the string?.. " X " the X that is the blank space you are guys are talking about..

" " is the string that needs to be repeated, so do not change it, add the repeat method on this string, that means you write the dot after the closing " and then the rest of the method following that

Thanks so much for your guidance. I figured it out

1 Like