Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

what is wrong with the code? I have looked at the forum and corrected accordingly. But it still dosent work

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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/27.0 Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

You should be seeing this error in your console:

This is because your function is not closed properly. You’ve lost the closing curly bracket, which should come on the line after the code you’ve just modified.

1 Like