Learn Introductory JavaScript by Building a Pyramid Generator - Step 61

Tell us what’s happening:

I have the above code . I don’t seem to be getting through this

Your code so far

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

function padRow(rowNumber, rowCount) {

// User Editable Region

  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/124.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 61

Your syntax is correct, but the challenge requires a blank space " " not empty string "".

Also, the space between repeat and (rowNumber) is not necessary. You can safely remove it (best practice). While it will work either way, this extra space can make your code a bit harder to read for others.

4 Likes