Tell us what’s happening:
Hello guys
Is that meant that I should use while(i>0){} in my for loop? Or above my for loop? Or after my for loop ?
Or non of them? Or instead I should change the element of my for loop to “i” be less than0?
Or I should apply other method ? I have tried all I mentioned above and no one was right!
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow(rowNumber, rowCount) {
return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}
// TODO: use a different type of loop
/*for (let i = 1; i <= count; i++) {
rows.push(padRow(i, count));
}*/
/*while (rows.length < count) {
rows.push(padRow(rows.length + 1, count));
}*/
// User Editable Region
for (let i = count; false; false) {
}
while(i>0){}
// 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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 100