Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

Tell us what’s happening:

Step 64 JS Building a pyramid generator.

I am trying something like this:

return " “.repeat(rowCount - rowNumber) + character. Repeat(rowNumber)+”";

But it just keeps failing! Please help. I tried the options given in the previous questions too but nothing is working and i dont know where i am going wrong.

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);}

// 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 + "\n" + row;
}

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

there should be a space repeated some number of times also at the end of the expression

Hey, its seems a bit redundent but do the same thing twice. :grinning:

I did something like this :
return " ".repeat(rowCount - rowNumber) + character.repeat(rowNumber)+ " " .repeat(rowCount - rowNumber);

but its not working

Its good just remember the tricky part of spacing around the + signs. If you still have issues reset the test page. Good luck

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

This is incorrect because you have to add the strings with whiteSpaces " " at the start and end of the character.repeat(rowNumber). But you have only add it to the start. Also add it to the end.

return " " + .repeat(rowCount - rowNumber) + character.repeat(rowNumber) + " "; This is still not working

The code you put up in your last post is correct. Can you do this again with the proper spacing also the quotation marks cant be side by side.

return " " + .repeat(rowCount - rowNumber) + character.repeat(rowNumber) + " ";

Remove the + sign after the first whitespace string.