Learn Introductory JavaScript by Building a Pyramid Generator - Step 32

Tell us what’s happening:

i am still being asked to log the value of i, please help and i have tried every variation… just i in the console does nott work

Your code so far

const character = "#";
const count = 8;
const rows = [];


// User Editable Region

for (let i = 0; i < 8; i = i + 1) {
  console.log( i);
  }

// User Editable Region

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 32

Hi there! You’ve modified the original code. Reset the task and just log the i iterator

My code is exactly the same. It still doesn’t work.
for (let i = 0; i < 8; i = i + 1) {
console.log(i);
}

I don’t know what the issue is. When I open the dev tools on my browser, it loops 8 times through the array and outputs the values.

Am I missing something here?

Did you reset the task?

YES, still hasn’t solved the issue.

This is the original template for this step.

for (let i = 0; i < count; i = i + 1) {

}

Where did you get this?
i < 8;

Don’t modify anything, just print the value of the i iterator within this loop

OH Crap, I just realized. I forgot that count was the condition. Instead I hardcoded 8 into the condition.

1 Like

Just glad I could be of help.
Good luck in your further coding

}  brackets and not outside thanks ```

make sure console.log(i) is in your brackets and not outside as you have been doing.

Hi there! The problem in this topic is solved. Thanks

1 Like

yes it is solved
but just incase everyone done what i done that is why i shared as that was the mistake i made thanks for everone’s help

OK, thank you.
And I’ve edited your message for readability. Please don’t use backticks to write the plain text.

1 Like

ok thanks for that so when do you use back ticks and when do you not use them thanks.

1 Like

When I console the output, it’s working as expected but my code is not accepted. Not sure why?

for (let x = 0; x <= count; x++) {}

Appreciated your suggestion.

I found the solution, it should be:
-REMOVED-

In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Help button located on each challenge. This will automatically import your code in a readable format and pull in the challenge url while still allowing you to ask any question about the challenge or your code.

Thank you.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.