Learn Introductory JavaScript by Building a Pyramid Generator - Step 49

Tell us what’s happening:

I’m able to get the correct code but hoping someone would be able to explain why let is unacceptable here? I understand they’re both block-scoped and that while let can be updated and re-declared, and const can not. What I’m missing is why that matters for this portion of the code?

Your code so far

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

function padRow() {

}

// User Editable Region

const versus 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 + row + "\n";
}

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 49

Hi there @CzarPetar . The challenge test only except const. If you think it’s should be improved, create an issue on GitHub in freeCodeCamp repository

1 Like