while (rows.length < count) {// while loop//
rows.push(padRow(rows.length + 1, count));
}
above is my code , i am on step 89 , what comment do i need to write in the loop body , it asked write a multi line comment in loop body
please can someone help?
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));
}*/
// User Editable Region
while (rows.length < count) {// while loop//
rows.push(padRow(rows.length + 1, count));
}
// 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 89
Commented code is not executed. This means that if you want to try a different approach to a problem by writing it in a different way, you can comment out a section of code so that it doesn’t run.
This can help in troubleshooting also. Try it out.
Ok, your code below has a TODO comment and below that the for loop is commented out with the /* and */. The TODO comment is a note to the programmer and is a special type of comment not executed by the computer.
The comment characters surrounding the for loop mean that the computer should ignore that code. In other words, the for loop will not run.