Learn Introductory JavaScript by Building a Pyramid Generator - Step 57

Tell us what’s happening:

let character = ‘!’;
function padRow(name) {

return character + name;

}
Hello. Something is wrong with my code. Please, help me.

Your code so far

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


// User Editable Region


let character = '!';
function padRow(name) {
   
    return character + name;
}

// User Editable Region

const call = padRow("CamperChan");
console.log(call);


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/128.0.0.0 Safari/537.36 OPR/114.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 57

Why do you have this line of code? It shouldn’t be there. Remove it and your code should pass.

1 Like

Thanks. You are right. I got very carried away by the example in the task and therefore mistakenly created the first, extra line as a modification of the one that was in the example.

1 Like