Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

Tell us what’s happening:

hi! I am confused what this step is asking when it comes to concatenating an empty variable.
in my code I have result defined as empty:
let result = “”

So, how would I concatenate an empty variable?

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) {
let result = row + "rows";
}


// User Editable Region


console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 42

Please click the reset button to restart this step.
The instructions said

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

That means literally exactly what it says. Use the plus sign to add the word row to the word result. This will concatenate the values in these two variables.
Then assign this statement to the variable result. (No need to declare result again as it is already declared earlier)

wow! thank you so much:) I got it figured out thanks to you.

1 Like