Learn Introductory JavaScript by Building a Pyramid Generator - Step 63

Tell us what’s happening:

How do i concatenate a blank space at the beginning and end of a repeated character string?

Your code so far

function padRow(rowNumber, rowCount) {

return “”+ character.repeat (rowNumber) + “”;

}

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


// User Editable Region

function padRow(rowNumber, rowCount) {
 return ""+ 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 63

you need to add a space character between the quotes in both places

I’m not understanding your reply this is space character"" which quotes do you mean we add between them

there is no space character there, that’s an empty string, there is nothing between the quotes

which character are we adding exactly please on the code

which space character are we adding between the quotes ?

you mean this"\n"? as a space character

No, the one you use to divide words, that is a space, isn’t it? If you want that into a string, you need to type it in the string

\n is the newline character

yes sure but I’m abit lost can you just type for me that character space that is used to divide words

It’s the one that appear when you press the spacebar

thank you so much ,I got it now