Tell us what’s happening:
Hey friends
I have tried many different ways to tackle this
erasing character and putting in " ".repeat
making a new " ".repeat above the return line
putting a new .repeat in the brackets of the return line
I understand why some of my tries didn’t work I was desperate on some of them. This is the latest try. I have read the answers to another question asked about this and have no idea if I need another .repeat notation or reform this one somehow. I’m lost
thanks in advance.
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(rowNumber, rowCount) {
return character + " " + " ".repeat(rowCount - rowNumber);
}
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(padRow(i + 1, count));
}
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/128.0.0.0 Safari/537.36 Edg/128.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 69