Learn Introductory JavaScript by Building a Pyramid Generator - Step 57

Tell us what’s happening:

Hello guys any help for step 57 in java script i m stucked

Your code so far

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


// User Editable Region

const character = " "; // Example character variable

function padRow(name) {
  
    return character + name;

     // Concatenate character to the beginning of name and return the result
}

// Example usage
padRow('lice');
 // Output: 'Alice'



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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 57

You re-declared what you already have at line 1.
Constants cannot be declared twice in the same scope. The instruction didn’t mention to do this.


I don’t know if I’m right, is this by AI ?
If so, you shouldn’t use it while you still learning to code as it make mistakes. Instead, focus on understanding the code and how it works rather than copying it directly.

1 Like

Thank you @MostafaElbadry it works
yea the second part from chatGpt indeed.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.