Tell us what’s happening:
concanate a row value to result value in a for…of loop
help me with a syntax please?
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){
i = i + "result";
}
// 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
they said:
use the addition operator to concatenate the row value to the result value.
Notice that they put the word row in a box? and result is also in a box? That is because these words are not normal words. They refer to variables you already have in the code.
For eg. the result variable was defined earlier on line 9.
While the row variable was defined on line 11 (inside the for loop).
You need to use these two words to complete the step. Reset and retry and keep this in mind as you try again.
1 Like
with your explanation, I thought this would work but it didn’t. I also tried it in this format: for (const row of rows) {“” = “” + row;}, same issue. I’m stuck, pls help.
Please open a topic for your question instead of replying to an old post. You seem to have ignored the part of the instruction that says you need to add row to result not add row to space or blank)