Learn Introductory JavaScript by Building a Pyramid Generator - Step 70

Tell us what’s happening:

I believe I’m did the correct answer but it says it’s wrong. CAn you help me detect the error please?

Your code so far

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

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

// User Editable Region

/*
for (let i = 1; i <= count; i++) {
  rows.push(padRow(i, count));
} 
*/


// User Editable Region


let result = "";

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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 70

Your code passes for me. Try another browser or disable extensions that may interfere with the tests.

As the note at the beginning of the course:

Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.

1 Like

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