Learn Introductory JavaScript by Building a Pyramid Generator - Step 60

Tell us what’s happening:

I am stuck on this code challenge and I have googled it but nothing is working

Your code so far

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


// User Editable Region

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

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 60

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

I don’t see you returning the character variable at all, can you show me code that does that?

Hello @mbas!

Ok, so you are at step 60 in this challenge and well done!

The challenge asks the following:

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

The character variable is :

You just need to repeat it using the repeat method.

The rowNumber parameter will be passed-in when the padRow function is called.

Focus on the repeat method, and once you have cracked that return the result of using that on character.

Check out this awesome article about how to repeat a string in js.

I am stuck on it and i have tried to search it up but nothing has helped

you return a value with the return keyword, show me you returning character, only that. Ignore the rest of the instructions for now, we will arrive there

function padRow(rowNumber, rowCount) {

return character

}

that’s a wonderful start. Now you need to use the repeat function on this variable, and use the proper argument

function padRow(rowNumber, rowCount) {

return character

rownumber.repeat(chracter);

}

no, you need to use repeat on character, like you are doing in the loop

can i be demonstated it pls

look at the loop you have written previously, here you are using repeat on character, you need to do the same now in the return statement

how do i do that i am confused

what are you confusing about? you have an example on how to use repeat, what part do you not understand?

I managed to sort it