Learn Introductory JavaScript by Building a Pyramid Generator - Step 59

Tell us what’s happening:

You should call padRow in your .push() call. here’s the code rows.push(padRow(i + 1));

Your code so far rows.push(padRow(i + 1));

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

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



// User Editable Region

rows.push(padRow(i + 1));



// User Editable Region

let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 59

but where is the loop?

not sure how do I fix the code

you need the loop, so you maybe should start with resetting the step, then change the content of the loop keeping the loop

I can’t reset it would reset all stuff I done here’s the scenario though A function call allows you to actually use a function. You may not have been aware of it, but the methods like .push() that you have been using have been function calls.

A function is called by referencing the function’s name, and adding (). Here’s how to call a test function:

test();
Replace the character.repeat(i + 1) in your .push() call with a function call for your padRow function.

the reset button will reset the current step to the starting code for this step, you deleted code you should have. Reset the step to recover this code

no only have reset lesson

yes, use that button

the reset button resets only the current step, use it so you can recover the code you have deleted

no I think it going reset the whole lesson not just that step

it resets the tests and code of this current step only, there is no way to reset a whole project or a whole section anywhere in the website

I dont want reset the test

Please click the button. You need to click the button to put back the code you deleted. The only thing that will change when you click the button is that the original code for this step will come back.

ok did it here’s the code now

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

Cool, now

Replace the character.repeat(i + 1) in your .push() call with a function call for your padRow function.

so what would be the final code

I cannot write the solution for you. That’s against the rules. You should try to replace the character.repeat(i + 1) in your .push() call with a function call for your padRow function and show us what that looks like.

how do I do that I am not really sure.

Ok, what words or phrases do you not understand

Replace the character.repeat(i + 1) in your .push() call with a function call for your padRow function.

I replaced character row with push call did not work