Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

Tell us what’s happening:

please I’m here with no clue on what to do and every post i checked seems to have a very different form of code so i want to know if im doing this the wrong way plus i dont understand what the result of my repeat is since its not in numbers but a parameter

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  character.repeat(rowNumber);
  
  return ;
  
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 64

what is your function returning?

1 Like

This line repeats the character but does not return it.

This line returns nothing.

You need to combine these two lines to return the repeated character

1 Like

thank you, i returned the “character” variable but still says the same

are you using repeat on that character variable?

1 Like

yes like this.
return character;
is that wrong?

for this line the answer to my question is “no”, there is no repeat here

1 Like

Use the return keyword to return the value of the character variable, repeated rowNumber times.

1 Like

this is what the code is like

character .repeat(rowNumber);
return character

you are still only returning character, and it’s not repeated

this line like this does nothing

1 Like

ohh okay thank you i will go work on it

Try to combine this into 1 line

1 Like

thank you will get back to it

1 Like

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