Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

I dont really understand how i am supposed to repeat the " ", cause if i make a second line of code saying return it gets invalid. If i do it in the same line as the first return tho it doesnt work

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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 OPR/116.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Hi and welcome to the forum!
To repeat the " ", you use .repeat() method. You have used it here:

But you need to use it on both " " which are located before and after character.repeat(rowNumber).
You don’t need to use the .repeat() on new " ", just use it on the two existing ones.

I hope this help!