Use the .repeat() method on your character, and give it i for the number.
Your code so far
const character = "#";
// User Editable Region
const count = 8;
const rows = [];
for (let i = 0; i < count; i = i + 1)
character.repeat(i);
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 45
Hi,
you need to reset your code because originally there is rows.push(character) inside your for loop. The step wants you to use .repeat() on the character inside the .push().
Good luck!
Hey there,
you can create a new topic using the help button on the step you’re stuck in. The help button appears after you’ve tried submitting your code at least three times.
Good luck!
Hi there and welcome. Create your own topic to the challenge step using Help button. It’s appear below the challenge editor, when you try to submit wrong code more than three times.