Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

Tell us what’s happening:

please how to assign the result of concatenaton back to var result

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) {
   row = row + result;

// User Editable Region

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

this code will add row to result (concatenate them) and then put the new string into row.
Did you want to put the new string into row?

i wanna use the addition operator to concatenate the row value to the result value.

you have already done that when you said: row + result
What else do you need to do?

yeah but it say that i have a error , i don’t know why where i’m wrong .
.

“You should assign the result of your concatenation back to the result variable.” it’s write like that :slightly_smiling_face:

if you change your code to just row + result what does the hint tell you to do?

correct. So are you doing that when you write
row = row + result
Remember, I explained earlier what you were doing…

please hot to put the new string into row !!

my friend: you wrote row = row + result
This will put the new string into row.

But is this what they want? No.

i think yes but it still not working :melting_face:

no, they don’t want you to assign it back to row.
They want you to assign it back to result.
This is what the hint means.

1 Like

result=row+result yeah like that is correct , a passs this task :laughing:
thanks lot , I stayed 4 hour in this task :upside_down_face:

3 Likes

You just needed to re-read the instructions I think.
On to the next one!

1 Like

The correct answer is (removed by mod)

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.