Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Tell us what’s happening:

my code is running perfectly but I keep getting an error that I have no idea how to solve

Your code so far

function padRow(rowNumber, rowCount) {

let character = “*”;
result = character.repeat(rowNumber);
return result;
}
console.log(padRow(10, 10));

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


// User Editable Region

function padRow(rowNumber, rowCount) {

  let character = "*";
   result = character.repeat(rowNumber);
  return result;
}
console.log(padRow(10, 10));
 

// 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 + 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/133.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Hi. The character variable is declared globally on line 1. They want you to use that (see the instructions).

what is ‘result’ in your code? It isn’t declaring a new variable called result. I suggest you follow the instructions carefully. What you have put on the right side of the = sign is right. You just need to add the return keyword.