Learn Introductory JavaScript by Building a Pyramid Generator - Step 87

Tell us what’s happening:

Cannot work out where I am going wrong. I have tried line 20 blank and with a let. Error messages appear to refer to mistakes I do think I have made. While I am messaging might be helpful to give a guide to reading the console top lines as oppose to lower ones with likes of console.log outputs.

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==false) {
  done=done++;
  if(done==count){
    continueLoop=true;
  }
}

// User Editable Region


let result = ""

for (const row of rows) {
  result = result + row + "\n";
}

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/134.0.0.0 Safari/537.36 Edg/134.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 87

Guide might be too grand a word pointers has since come to me as a better word.

Hi there,

It looks like you’ve added unnecessary elements to your lesson. The task only requires an if statement to check if done is equal to count using the equality operator.

To fix this, first reset your lesson to its original state. Then, without making any additional changes, insert the if statement and the condition right after:

while (continueLoop) {  
  done++;  
  // Insert if statement here  
}  

This ensures your code aligns with the lesson instructions correctly.

Just spotted the unnecessary done= it has been removed

Just to be sure—did the fix actually work as expected?

No removing the the done= and the if content, has not solved it. Regarding your initial I would using the word reset in future, as there is a reset which appears from the warning message given delete all progress on that lesson not just the current step.

Updated screenshot after some correctios have been made. However the I still don’t pass the step.

You can remove the ==false from while (continueLoop == false) { and Let me know if that works!

1 Like

Also, resetting the step only resets the current step and does not affect your overall progress.
image

It has worked, thankyou.

Great to hear it worked! :blush: You’re welcome! Let me know if you need any more help.

If this is so maybe they need to improve the error message as this not the impression it is gives.
"Reset this lesson?

Are you sure you wish to reset this lesson? The editors and tests will be reset.

This cannot be undone."
I will double check you are right when I reach step two of the next lesson. I want to trust you but I know nothing about you.

When you click that,

you’ll see this screen. It will ask you to confirm if you want to reset, or if you accidentally click it.


(It will only reset the current step or lesson along with the code you added, and it will reset the preview, console, and other elements so you start fresh.But it will not reset your overall progress.)

If you’re still confused or it’s not working correctly, you can always reach out to the freeCodeCamp support forum and ask them about your issue in more detail.

I will do. You answered my original point so deserve the heart and solution tag. So since due to that the admins will probably not see the error message point a separate post is needed.

1 Like

Thank you so much for the heart and solution tag! :blush: I’m glad I could help. You’re right—since the admins might not see the error message point, it’s a good idea to post that separately. Let me know if you need any more assistance

1 Like

seoexpert there is something else you can help me with, the second part of my original message. However I will explain it better and now have an image to refer to. Look to the the right side of the image I am commenting on. The number point do they refer to the objectives that need to be achieved for that step which I have not. Hence why sometimes you see for example a “2., 3, and 6,” but no “1., 4., and 5.”. Secondly am I right in thinking that these output lines, are course specific and will not appear if I were writing JavaScript in other spaces such as GitHub or visual studio code.

Which numbers are you referring to? (As I don’t see any numbers in your screenshot, besides the file numbers.)


(In the image, the only numbers showing are to indicate the order.)

Numbers on the right.

It took me a while to understand, but I now get what you’re trying to say. Yes, that happens sometimes as all errors in the console are ordered. So, if you fix the 3rd one first and leave the 2nd and 4th, only the unfixed errors will show. That’s why you sometimes see them missing. Don’t worry about it; let’s focus on progress, not the environment. :sweat_smile: if still have douts or i understand it wrong feel free to ask!

1 Like

Thankyou I wanted to be sure I understand as sometimes is not obvious I made the error referred. Don’t worry I have plenty of experience with error message sometimes only being a indication of what you done wrong. I know that sometimes changing something, not referred to in an error message resolves it