Learn Introductory JavaScript by Building a Pyramid Generator - Step 41

Tell us what’s happening:

i can’t seem to figure step 41 and i’ve tried everything i could

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



// 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/131.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 41

show us one of the things you tried please

Please post your code, not a screenshot.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').



for (const value of row) [

const row = rows

]

your iterable must be something that already exists. In this case you are asked to iterate over rows so that must be your iterable.

for (const value of rows) {

}
const row
// running tests
4. Your for...of loop should declare your row variable.
5. Your row variable should be extracted from rows using the of keyword.
6. Your for...of loop body should be empty.
// tests completed

this is what i was getting earliar as well and i can’t seem to move forward

Create a for...of loop to iterate through your rows array, assigning each value to a row variable.

You are asked to use a specific value for the variable of the loop, can you find in the quotes above which value this is?

i still don’t get it

did you try changing the name of the loop variable? in the example it’s value, you should not use the same name as the example

what is your code now?

for (const 8 of rows) {

}

const row

Hi there! The instructions is asking you: Create a for...of loop to iterate through your rows array, assigning each value to a row variable.

You need to declare the row variable within the loop condition. Currently you have declared 8.

yeah i got it thanks

1 Like