Learn Introductory JavaScript by Building a Pyramid Generator - Step 36

Tell us what’s happening:

The variable (row) should be declared in the (for… of) loop. In the meantime, as my code does not pass, I am told that the (for …of) loop should have an empty body. I don’t understand what an empty body is in this case. I tried using a colon, but the code didn’t pass also. My last code was:
const row = rows;
for (const row of rows);
result = row;
console.log(result);

The result as printed was 8 iterations from 0 to 7.

Your code so far

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

for (let i = 0; i < count; i = i + 1) {
  rows.push(i);
}

let result = ""


// User Editable Region

const row = rows;
for (const row of rows);
result = row;
console.log(result);

// User Editable Region


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 36

Hello!
Your for needs a block statement, which is {} and it needs to be empty.

Welcome back to the forum @haahinnawy

Refer to your previous loop.

If you remove the code between the curly braces, then the body of the loop statement becomes empty.

Happy coding

Try this:
mod edit: solution removed

Posting full working code is not allowed here on the forum.

my bad. i had no idea

1 Like