I don’t really understand why my code is wrong because I think it is correct. please help and correct me if I’m wrong. step 45
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(character);
character.repeat(i);
}
// User Editable Region
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 45
can someone please help me I’ve been stuck on step 45 since last night PLEASE fix my code I don’t know how many times I’ve changed it.
for (let i = 0; i < count; i = i + 1) {
character.repeat(i);
let row = character.repeat(i);
rows.push(row);
}
you aren’t using character.repeat(i) in the .push() method. You have created a row variable and assigned the value character.repeat(i) to it. Then you used the row variable in the .push() method.