Required is to change the while loop condition to check if done and count are not equal. The condition was: done++; I added the inequality of done and count, but this is not recognized. The test result continued to say that the while condition should be changed to check if done and count are not equal.
So far, the code is:
while (continueLoop) {
done++, done !== count;
rows.push(padRow(done, count));
continueLoop = false;
I don’t know what is wrong in the condition as I put it.
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));
}*/
let continueLoop = false;
let done = 0;
// User Editable Region
while (continueLoop) {
done++, done !== count;
rows.push(padRow(done, count));
continueLoop = false;
}
// 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/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 82
Thank you. I reset the lesson as you said but the test comment is still the same. Considering what you said about a wrong place I tried to write the two elements of the condition in two separate lines but this was also invalid. I can’t see other alternatives for places.