Learn Introductory JavaScript by Building a Pyramid Generator - Step 46

Tell us what’s happening:

I have a general question. when will I be able to understand how does whole “loop” or “for” things work? :frowning:

Your code so far

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


// User Editable Region

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

// User Editable Region


let result = ""

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

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 46

hi and welcome back to the forum.
This curriculum is in beta and fCC is working on improving it.
I can suggest that you read this today to help you get more understanding though:

There are more resources online that are more in depth but I think this link will be a good start for you.

2 Likes