Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

Tell us what’s happening:

Hi,
i know what the end result should be but i have the formula wrong. can anyone help

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 = result + "rows" ;
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

you are asked to add the value of the row variable, not the string "rows". Do you know how to distinguish between a variable and a string?

variable is the store of information and string is what is inside

and if you have ghhk and "ghhk", do you know if they are a string or a variable?

“ghhk” is the string

so you need to add the row variable. Rewrite this line keeping that in mind:

it’a asking for the value which is what is confusing me

you get the value of a variable by using the variable

I still don’t get it

do you understand why this is not the right answer?

Yes.

Sorry, I have similar issues and can’t seem to figure it out.

I got it now. Thanks.

hey @Gaius_01 , when you need help please create your own topic

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like