Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

Tell us what’s happening:

My brain is not Thinking well, so I have to concatenate by using + right? or using the library .concat? So what I have Imagines is I am inside on a for of loop then the rows are already looped (0,1,2,n) then the result must be 1 + " "?

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

for (const row of rows) {
  result = row.concat;
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

In the for...of loop the row variable represents the current element for that iteration instead of having to call rows[i] now you have row that is type string.

So what would you set the result variable to when using row and result?

so if the ROW is a type of STRING then result = ROW(typeof String) + ??

That is very close. I was just letting you know the row variable is of type string to show that you can use row like a string to add two strings together. You can call the variable row and concatenate it to the other variable using +.

 var1 = var2 + var1;

Yes, but don’t post the answer, instead test it out by entering it to the challege. Please remove it before the mods do.

Do you do free tutoring session? :hugs:

At the moment I don’t do any tutoring but in future I might start a weekly group video conference (or join one) to get better at coding .