How can l use the addition operator to concatenate the row value to the result value?
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 + "row";
// User Editable Region
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 39
The example given in the instructions demonstrates how you could concatenate a string onto an existing variable.
However, row is not a string but a variable, so should not have quote marks around it.
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);
Unfortunately, now you cannot see what your loop is doing.
Use let to declare a result variable, and assign it an empty string. An empty string is represented by quotation marks with nothing between them, such as "". Sorry, your code does not pass. You’re getting there.
Your result variable should be an empty string. can u help me with this please ?
Hi @geoffrey23, if you have a question about your code, please open your own topic for it.
You can create a forum help post by clicking on the Help button, which appears after you have submitted incorrect code three times.
This post will automatically include your full code, a direct link to the challenge and an opportunity for you to describe your issue in detail.