Learn Introductory JavaScript by Building a Pyramid Generator - Step 37

Tell us what’s happening:

they keep saying that I should log the value of i inside of for loop even though I’ve done that and the output is 8 am I missing a space or something?

Your code so far

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


// User Editable Region

for (let i = 0; i < count; 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/109.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 37

The “inside” of the loop is the part between the parenthesis

Here is an example:

for (let v = 1; v < 3; v++) {
  //this is the inside of the loop
}
1 Like

Hi there!

You added the console at on the wrong place. You need to add it within the loop body, not within the condition.

1 Like

thank you (: it’s worked for me . but now the result is differant instead of : 1
2
3
4
5
6
7
8
it’s: 0
1
2
3
4
5
6
7
since i put it outside of the condition.

That is expected. The console log statement is logging the value of i, correct?
Since your for loop starts declares the i with value zero, the log will show zero first.

1 Like