Learn Introductory JavaScript by Building a Pyramid Generator - Step 44

Tell us what’s happening:

I by no means do I need the solution but just understanding behind it. I know that I should use a “const” to assign the variable “call” to the function “padRow” . But I thought I should experiment and see if let would work as well. They essential do the same job other than the fact that “let” mutibable. I can’t understand why that would be result in a error though. I figure it might be the fact the solution is made to only accept const but I just wanted to make sure that is the case.

Your code so far

const character = "#";
const count = 8;
const rows = [];

function padRow() {

}

// User Editable Region

let call = padRow();

// User Editable Region



for (let i = 0; i < count; i = i + 1) {
  rows.push(character.repeat(i + 1))
}

let result = ""

for (const row of rows) {
  result = result + "\n" + row;
}

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/124.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 44

Welcome to the forum!

You are correct that some answers require a hard-coded reply. Sometimes because that’s the only right solution. Many times to lower the workload for the developers, who are all volunteers in fCC. It would take too much of their time to think of every possible answer.

Welcome to the forum @bhatiaom2004

The instructions want you to declare call using const so that the variable does not mutate. Using the let keyword may work, however if the variable is reassigned later on, then the whole program may not work.

Happy coding