Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Tell us what’s happening:

I do not know how to do this. Please explain this to me.

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  
}

// 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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Hi there!

You didn’t tried anything yet for the challenge step. What help do you want?

I do not know how I am going to use the return keyword to return the value of the character variable, repeated rowNumber times.

Hi there.

To be more clear, is your question; how do I return something?

Or: how do I repeat the character variable?

You know how to use the return keyword, right? Because you’ve used it in previous steps.

Try to ask questions using your own words, don’t just repeat the instructions.

How do I repeat the character variable?

Please check line number 11 in your code. Earlier you wrote some code that repeated the character variable and if you look in line 11 it will jog your memory.

But the screen instruction calls for " Use the return keyword to return the value of the character variable, repeated rowNumber times."
Where is this repeat coming from here?

hi!

.repeat() is a javascript method for repeating the value you want to repeat it how many times.

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.