Please can someone show me how to do the cocantenation. Its confusing me. Its seems freecodecmp isnt trying to speak english. Hahaha
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 = rows + 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/109.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 37
// running tests
You should use the concatenation operator on your result variable.
You should concatenate row to your result variable.
You should assign the result of your concatenation back to the result variable.
// tests completed
// console output
Uncaught TypeError: “row” is read-only
The console is giving you some clues.
Uncaught TypeError: “row” is read-only
You declared row with a const declaration, therefore it cannot change. const meaning constant.
You should assign the result of your concatenation back to the result
Your code is assigning it to row
You should concatenate row to your result variable.
Here the instructions are asking for a specific order of variables.
Reread the example to so you can understand the syntax required.
You can do a similar thing with a string value, by appending a new string to an existing string. For example, hello = hello + " World"; would add the string " World" to the existing string stored in the hello variable. This is called concatenation.
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.