I cannot solve question 86 in javascript algorithms and data structures

start by using the increment operator to increase the value of the done variable inside your loop.

I did this but it doesn’t work:

while (continueLoop) {
done ++;
}

If you need help with a particular challenge, we’ll need some kind of context to work with, including a link to the challenge.

The best way to do this is to click the Help button, which appears after you have submitted incorrect code three times.
This will create a forum post which automatically includes your full code, a direct link to the challenge, and an opportunity for you to describe your issue in detail.

Tell us what’s happening:

start by using the increment operator to increase the value of the done variable inside your loop.

I did this but it doesn’t work:

while (continueLoop) {
done ++;
}

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 = true;
const done = 0;


// User Editable Region

while (continueLoop) {
   done ++;
}

// 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 86

Ah, sorry I didn’t spot this in your initial post but you should not have a space between done and the increment operator.

1 Like

oh great, thanks very much

1 Like

In future, please stick to opening one topic per challenge/project/question.
I have merged the duplicates.