Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

Tell us what’s happening:

My function works perfectly but it gives me an error.

Your code so far

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


// User Editable Region

function padRow(character, rowNumber) {
  let test = character.repeat(rowNumber);
  return test;
}

// User Editable Region



for (let i = 0; i < count; i = i + 1) {
  rows.push(character.repeat(i + 1))
}

let result = ""

for (const row of rows) {
  result = result + "\n" + row;
}

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

The instructions want you to just have one line of code in the function.

1 Like

“Character” is already defined with “const”. No need to do it again.

You’ve gone wrong in the parameters, one is wrong. You weren’t asked to change this so suggest you reset.

Only the return value is needed in the string, as asked in step 64.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.